Skip to content

Commit

Permalink
Merge Twisted dont-unroll-5460
Browse files Browse the repository at this point in the history
Author: exarkun
Reviewer: MostAwesomeDude
Fixes: twisted#5460

Slightly simplify the implementation of serializing tags and such to HTML
by removing several occurrences of manual loop unrolling.  These will be
handled by the serialization trampoline automatically.


git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/trunk@33495 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb
exarkun committed Jan 27, 2012
1 parent 320c51e commit 003234b
Showing 2 changed files with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions twisted/web/_flatten.py
Original file line number Diff line number Diff line change
@@ -147,9 +147,7 @@ def _flattenElement(request, root, slotData, renderFactory, inAttribute):
return

if not root.tagName:
for element in _flattenElement(request, root.children, slotData,
renderFactory, False):
yield element
yield _flattenElement(request, root.children, slotData, renderFactory, False)
return

yield '<'
@@ -162,15 +160,11 @@ def _flattenElement(request, root, slotData, renderFactory, inAttribute):
if isinstance(k, unicode):
k = k.encode('ascii')
yield ' ' + k + '="'
for element in _flattenElement(request, v, slotData,
renderFactory, True):
yield element
yield _flattenElement(request, v, slotData, renderFactory, True)
yield '"'
if root.children or tagName not in voidElements:
yield '>'
for element in _flattenElement(request, root.children,
slotData, renderFactory, False):
yield element
yield _flattenElement(request, root.children, slotData, renderFactory, False)
yield '</' + tagName + '>'
else:
yield ' />'
Empty file added twisted/web/topfiles/5460.misc
Empty file.

0 comments on commit 003234b

Please sign in to comment.