Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made _get_inner_body a little more sane and robust

  • Loading branch information...
commit 6ffb9988bb4fc8feb58587ca12e4daaf5f92a6c4 1 parent cc4828b
@ojii ojii authored
Showing with 4 additions and 8 deletions.
  1. +4 −8 cms/utils/html.py
View
12 cms/utils/html.py
@@ -18,14 +18,10 @@ def _rec(node):
return childfound
return None
body = _rec(doc)
- # if the first element after <body> is a html tag, this returns an Element
- # instance, otherwise a (unicode) string, this is why we need to check
- # the output of this and potentially call .toxml() again.
- out = reduce(lambda x,y:x.toxml()+y.toxml(), body.childNodes)
- if isinstance(out, basestring):
- return out
- return out.toxml()
-
+ out = []
+ for node in body.childNodes:
+ out.append(node.toxml())
+ return u''.join(out)
def clean_html(data, full=True, parser=DEFAULT_PARSER):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.