[Checkins] SVN: five.pt/trunk/ Added test function to template context.
Malthe Borch
mborch at gmail.com
Thu Feb 19 03:20:46 EST 2009
Log message for revision 96723:
Added test function to template context.
Changed:
U five.pt/trunk/CHANGES.txt
U five.pt/trunk/src/five/pt/pagetemplate.py
-=-
Modified: five.pt/trunk/CHANGES.txt
===================================================================
--- five.pt/trunk/CHANGES.txt 2009-02-19 08:17:18 UTC (rev 96722)
+++ five.pt/trunk/CHANGES.txt 2009-02-19 08:20:46 UTC (rev 96723)
@@ -1,6 +1,8 @@
Changelog
=========
+- Added test function to template context. [malthe]
+
- Fixed edge-case (special case?) where the view of a
ViewPageTemplateFile is really only the view for a view. [malthe]
Modified: five.pt/trunk/src/five/pt/pagetemplate.py
===================================================================
--- five.pt/trunk/src/five/pt/pagetemplate.py 2009-02-19 08:17:18 UTC (rev 96722)
+++ five.pt/trunk/src/five/pt/pagetemplate.py 2009-02-19 08:20:46 UTC (rev 96723)
@@ -17,6 +17,11 @@
if method is not None:
return method()
+def test(condition, a, b):
+ if condition:
+ return a
+ return b
+
class BaseTemplate(pagetemplate.BaseTemplate):
"""Zope 2-compatible page template class."""
@@ -43,6 +48,7 @@
here=context,
container=context,
nothing=None,
+ test=test,
path=pagetemplate.evaluate_path,
exists=pagetemplate.evaluate_exists,
root=get_physical_root(context),
More information about the Checkins
mailing list