[Checkins] SVN: z3c.pt/trunk/ Catch name-error in exists-evaluator and return false.

Malthe Borch mborch at gmail.com
Mon Mar 2 04:01:08 EST 2009


Log message for revision 97410:
  Catch name-error in exists-evaluator and return false.

Changed:
  U   z3c.pt/trunk/CHANGES.txt
  U   z3c.pt/trunk/src/z3c/pt/pagetemplate.py

-=-
Modified: z3c.pt/trunk/CHANGES.txt
===================================================================
--- z3c.pt/trunk/CHANGES.txt	2009-03-02 07:25:04 UTC (rev 97409)
+++ z3c.pt/trunk/CHANGES.txt	2009-03-02 09:01:07 UTC (rev 97410)
@@ -3,6 +3,8 @@
 
 In next release
 
+- Catch ``NameError`` in exists-evaluator (return false). [malthe]
+
 - If the supplied ``context`` and ``request`` parameters are trivial,
   get them from the view instance. [malthe]
 

Modified: z3c.pt/trunk/src/z3c/pt/pagetemplate.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/pagetemplate.py	2009-03-02 07:25:04 UTC (rev 97409)
+++ z3c.pt/trunk/src/z3c/pt/pagetemplate.py	2009-03-02 09:01:07 UTC (rev 97410)
@@ -69,7 +69,10 @@
     return evaluate_expression('path', expr)
 
 def evaluate_exists(expr):
-    return evaluate_expression('exists', expr)
+    try:
+        return evaluate_expression('exists', expr)
+    except NameError:
+        return False
 
 class BaseTemplate(template.PageTemplate):
     default_parser = language.Parser()



More information about the Checkins mailing list