[Checkins] SVN: z3c.pt/trunk/ Inline the _escape function,
because function calls are expensive in Python.
Florian Schulze
florian.schulze at gmx.net
Tue Jul 22 17:42:49 EDT 2008
Log message for revision 88738:
Inline the _escape function, because function calls are expensive in Python.
Changed:
U z3c.pt/trunk/CHANGES.txt
U z3c.pt/trunk/src/z3c/pt/clauses.py
-=-
Modified: z3c.pt/trunk/CHANGES.txt
===================================================================
--- z3c.pt/trunk/CHANGES.txt 2008-07-22 20:35:16 UTC (rev 88737)
+++ z3c.pt/trunk/CHANGES.txt 2008-07-22 21:42:48 UTC (rev 88738)
@@ -4,6 +4,9 @@
Version 0.8.x
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+- Inline the _escape function, because function calls are expensive in Python.
+ [fschulze]
+
- When templates are instantiated outside of a class-definition, a
relative file path will be made absolute using the module path.
[malthe]
Modified: z3c.pt/trunk/src/z3c/pt/clauses.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/clauses.py 2008-07-22 20:35:16 UTC (rev 88737)
+++ z3c.pt/trunk/src/z3c/pt/clauses.py 2008-07-22 21:42:48 UTC (rev 88738)
@@ -708,20 +708,27 @@
stream.write("_write(_urf)")
stream.outdent()
stream.write("elif _urf is not None:")
- stream.indent()
- if self.structure:
- stream.write("_write(str(_urf))")
- else:
- stream.write("_write(_escape(_urf))")
- stream.outdent()
else:
stream.write("if _urf is not None:")
+ stream.indent()
+ if self.structure:
+ stream.write("_write(str(_urf))")
+ else:
+ stream.write("_urf = str(_urf)")
+ stream.write("if '&' in _urf:")
stream.indent()
- if self.structure:
- stream.write("_write(str(_urf))")
- else:
- stream.write("_write(_escape(_urf))")
+ stream.write("_urf = _urf.replace('&', '&')")
stream.outdent()
+ stream.write("if '<' in _urf:")
+ stream.indent()
+ stream.write("_urf = _urf.replace('<', '<')")
+ stream.outdent()
+ stream.write("if '>' in _urf:")
+ stream.indent()
+ stream.write("_urf = _urf.replace('>', '>')")
+ stream.outdent()
+ stream.write("_write(_urf)")
+ stream.outdent()
def end(self, stream):
if self.assign:
More information about the Checkins
mailing list