[Checkins] SVN: z3c.pt/trunk/ Interpolation feature switched off per default.
Stefan Eletzhofer
stefan.eletzhofer at inquant.de
Tue Dec 2 08:30:40 EST 2008
Log message for revision 93535:
Interpolation feature switched off per default.
Changed:
U z3c.pt/trunk/CHANGES.txt
U z3c.pt/trunk/CONTRIBUTORS.txt
U z3c.pt/trunk/src/z3c/pt/README.txt
U z3c.pt/trunk/src/z3c/pt/pagetemplate.py
U z3c.pt/trunk/src/z3c/pt/texttemplate.py
-=-
Modified: z3c.pt/trunk/CHANGES.txt
===================================================================
--- z3c.pt/trunk/CHANGES.txt 2008-12-02 13:24:44 UTC (rev 93534)
+++ z3c.pt/trunk/CHANGES.txt 2008-12-02 13:30:40 UTC (rev 93535)
@@ -4,6 +4,9 @@
Head
~~~~
+- Switched off the $-interpolation feature per default; It may be activated
+ on a per-template basis using ``meta:interpolation='true'``. [seletz]
+
- Allow more flexibility in overriding the PathTranslator method. [hannosch]
- Removed the forced defaultencoding from the benchmark suite. [hannosch]
Modified: z3c.pt/trunk/CONTRIBUTORS.txt
===================================================================
--- z3c.pt/trunk/CONTRIBUTORS.txt 2008-12-02 13:24:44 UTC (rev 93534)
+++ z3c.pt/trunk/CONTRIBUTORS.txt 2008-12-02 13:30:40 UTC (rev 93535)
@@ -3,3 +3,4 @@
Hanno Schlichting
Philipp von Weitershausen
Wichert Akkerman
+Stefan Eletzhofer
Modified: z3c.pt/trunk/src/z3c/pt/README.txt
===================================================================
--- z3c.pt/trunk/src/z3c/pt/README.txt 2008-12-02 13:24:44 UTC (rev 93534)
+++ z3c.pt/trunk/src/z3c/pt/README.txt 2008-12-02 13:30:40 UTC (rev 93535)
@@ -103,6 +103,40 @@
<span>test</span>
</div>
+Dollar-Interpolation
+--------------------
+
+As ``z3c.pt` **should** be as compatible as possible to it's original,
+we don't allow $-interpolation like in ``chameleon.zpt``::
+
+ >>> template = PageTemplate("""\
+ ... <div xmlns="http://www.w3.org/1999/xhtml">
+ ... ${this does not break}
+ ... </div>""")
+
+ >>> print template()
+ <div>
+ ${this does not break}
+ </div>
+
+But we can **enable** this in a template::
+
+ >>> template = PageTemplate("""\
+ ... <div xmlns="http://www.w3.org/1999/xhtml"
+ ... xmlns:meta="http://xml.zope.org/namespaces/meta">
+ ... <div meta:interpolation="true">
+ ... ${options/foo}
+ ... </div>
+ ... </div>""")
+
+ >>> print template(foo=u'bar')
+ <div>
+ <div>
+ bar
+ </div>
+ </div>
+
+
Text templates
--------------
Modified: z3c.pt/trunk/src/z3c/pt/pagetemplate.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/pagetemplate.py 2008-12-02 13:24:44 UTC (rev 93534)
+++ z3c.pt/trunk/src/z3c/pt/pagetemplate.py 2008-12-02 13:30:40 UTC (rev 93535)
@@ -2,12 +2,13 @@
import sys
import chameleon.zpt.template
-import chameleon.zpt.language
+import z3c.pt.language
+
from zope import i18n
class BaseTemplate(chameleon.zpt.template.PageTemplate):
- default_parser = chameleon.zpt.language.Parser(default_expression='path')
+ default_parser = z3c.pt.language.Parser()
def bind(self, ob, request=None, macro=None, global_scope=True):
def render(target_language=None, **kwargs):
Modified: z3c.pt/trunk/src/z3c/pt/texttemplate.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/texttemplate.py 2008-12-02 13:24:44 UTC (rev 93534)
+++ z3c.pt/trunk/src/z3c/pt/texttemplate.py 2008-12-02 13:30:40 UTC (rev 93535)
@@ -1,3 +1,5 @@
+import chameleon.zpt.language
+
import pagetemplate
class TextTemplate(pagetemplate.PageTemplate):
@@ -2,14 +4,18 @@
__doc__ = pagetemplate.PageTemplate.__doc__ # for Sphinx autodoc
+ default_parser = chameleon.zpt.language.Parser(default_expression="path")
format = 'text'
class TextTemplateFile(pagetemplate.PageTemplateFile):
__doc__ = pagetemplate.PageTemplateFile.__doc__ # for Sphinx autodoc
+ default_parser = chameleon.zpt.language.Parser(default_expression="path")
format = 'text'
class ViewTextTemplate(pagetemplate.ViewPageTemplate):
__doc__ = pagetemplate.ViewPageTemplate.__doc__ # for Sphinx autodoc
+ default_parser = chameleon.zpt.language.Parser(default_expression="path")
format = 'text'
-
+
class ViewTextTemplateFile(pagetemplate.ViewPageTemplateFile):
__doc__ = pagetemplate.ViewPageTemplateFile.__doc__ # for Sphinx autodoc
+ default_parser = chameleon.zpt.language.Parser(default_expression="path")
format = 'text'
More information about the Checkins
mailing list