SVN: r23243 - trunk/quixote
Neil Schemenauer <nascheme-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Tue, 25 Nov 2003 11:27:14 -0500
| Newsgroups | gmane.comp.web.quixote.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: nascheme
Date: 2003-11-25 11:27:14 -0500 (Tue, 25 Nov 2003)
New Revision: 23243
Modified:
trunk/quixote/html.py
Log:
Make htmltag() more efficient by avoiding repeated string concatenation.
Modified: trunk/quixote/html.py
===================================================================
--- trunk/quixote/html.py 2003-11-25 00:32:18 UTC (rev 23242)
+++ trunk/quixote/html.py 2003-11-25 16:27:14 UTC (rev 23243)
@@ -72,19 +72,19 @@
def htmltag (tag, xml_end=0, css_class=None, **attrs):
"""Create a HTML tag.
"""
- r = "<%s" % tag
+ r = ["<%s" % tag]
if css_class is not None:
attrs['class'] = css_class
for (attr, val) in attrs.items():
if val is ValuelessAttr:
val = attr
if val is not None:
- r += ' %s="%s"' % (attr, _escape_string(str(val)))
+ r.append(' %s="%s"' % (attr, _escape_string(str(val))))
if xml_end:
- r += " />"
+ r.append(" />")
else:
- r += ">"
- return htmltext(r)
+ r.append(">")
+ return htmltext("".join(r))
def href (url, text, title=None, **attrs):