From dfefe3cdda9acd94032e100d0507f9c73ed8cd36 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Fri, 28 Jan 2011 12:07:27 +1300 Subject: 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. --- libmproxy/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libmproxy/utils.py') diff --git a/libmproxy/utils.py b/libmproxy/utils.py index a02ac840..7b9d0e32 100644 --- a/libmproxy/utils.py +++ b/libmproxy/utils.py @@ -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): -- cgit v1.2.3