Make pretty-printing more robust.

Also, since BeautifulSoup is so damn slow, print a statusbar message saying
that we're calculating a pretty version of the response. Maybe I should add
hangman or something, becuase on a 200k document this can take ages.
This commit is contained in:
Aldo Cortesi
2011-01-28 12:07:27 +13:00
parent 93ef691bad
commit dfefe3cdda
3 changed files with 16 additions and 7 deletions

View File

@@ -47,8 +47,9 @@ def prettybody(s):
Return a list of pretty-printed lines.
"""
s = BeautifulSoup.BeautifulStoneSoup(s)
s = s.prettify()
return s.split("\n")
s = s.prettify().strip()
parts = s.split("\n")
return [repr(i)[1:-1] for i in parts]
def hexdump(s):