Skip to content

Commit

Permalink
you don't need to fix closing tags with method='html'
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbe committed Mar 6, 2013
1 parent 75c1e90 commit 9b7039a
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions proxy/app.py
Expand Up @@ -196,14 +196,7 @@ def css_url_replacer(match, href=None):
collect_stats collect_stats
) )


html = etree.tostring(page) html = etree.tostring(page, method='html')
# the etree.tostring() method will turn `<script src="foo"></script>'
# to `<script src="foo"/>`. Fix that.
for each, tag in CLOSING_REGEX.findall(html):
html = html.replace(
each,
each.replace('/>', '></%s>' % tag)
)
if collect_stats: if collect_stats:
html = re.sub( html = re.sub(
'<body[^>]*>', '<body[^>]*>',
Expand Down

0 comments on commit 9b7039a

Please sign in to comment.