[Checkins] SVN: z3c.pt/trunk/ Fixed exists-traverser such that it always returns a boolean value.

Malthe Borch mborch at gmail.com
Tue Feb 24 12:23:55 EST 2009


Log message for revision 97214:
  Fixed exists-traverser such that it always returns a boolean value.

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

-=-
Modified: z3c.pt/trunk/CHANGES.txt
===================================================================
--- z3c.pt/trunk/CHANGES.txt	2009-02-24 16:35:45 UTC (rev 97213)
+++ z3c.pt/trunk/CHANGES.txt	2009-02-24 17:23:54 UTC (rev 97214)
@@ -1,6 +1,11 @@
 Changelog
 ---------
 
+In next release
+
+- Fixed exists-traverser such that it always returns a boolean
+  value. [malthe]
+
 1.0b9 (2009/02/19)
 ~~~~~~~~~~~~~~~~~~
 

Modified: z3c.pt/trunk/src/z3c/pt/expressions.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/expressions.py	2009-02-24 16:35:45 UTC (rev 97213)
+++ z3c.pt/trunk/src/z3c/pt/expressions.py	2009-02-24 17:23:54 UTC (rev 97214)
@@ -65,12 +65,13 @@
 class ZopeExistsTraverser(ZopeTraverser):
     exceptions = AttributeError, LookupError, TypeError
     
-    def __call__(self, *args, **kwargs):
+    def __call__(self, base, request, call, *args, **kwargs):
         try:
-            return ZopeTraverser.__call__(self, *args, **kwargs)
+            return ZopeTraverser.__call__(
+                self, base, request, False, *args, **kwargs) is not None
         except self.exceptions:
-            return 0
-        return 1
+            return False
+        return True
 
 class PathTranslator(expressions.ExpressionTranslator):
     path_regex = re.compile(



More information about the Checkins mailing list