[Checkins] SVN: grok/trunk/src/grok/ Changed test in Traverser to ensure that empty (and therefore boolean False) containers are correctly traversed. Extended containertraverser ftest to test this.

Darryl Cousins darryl at darrylcousins.net.nz
Fri Apr 13 20:55:45 EDT 2007


Log message for revision 74127:
  Changed test in Traverser to ensure that empty (and therefore boolean False) containers are correctly traversed. Extended containertraverser ftest to test this.

Changed:
  U   grok/trunk/src/grok/components.py
  U   grok/trunk/src/grok/ftests/traversal/containertraverser.py

-=-
Modified: grok/trunk/src/grok/components.py
===================================================================
--- grok/trunk/src/grok/components.py	2007-04-14 00:21:16 UTC (rev 74126)
+++ grok/trunk/src/grok/components.py	2007-04-14 00:55:44 UTC (rev 74127)
@@ -317,7 +317,7 @@
 
         if IReadContainer.providedBy(self.context):
             item = self.context.get(name)
-            if item:
+            if item is not None:
                 return item
 
         raise NotFound(self.context, name, request)

Modified: grok/trunk/src/grok/ftests/traversal/containertraverser.py
===================================================================
--- grok/trunk/src/grok/ftests/traversal/containertraverser.py	2007-04-14 00:21:16 UTC (rev 74126)
+++ grok/trunk/src/grok/ftests/traversal/containertraverser.py	2007-04-14 00:55:44 UTC (rev 74127)
@@ -51,6 +51,14 @@
   </body>
   </html>
 
+Also try traversing (an empty and therefore False in a Boolean sense) container
+as a subitem of a container:
+
+  >>> herd['subherd'] = Herd()
+  >>> browser.open("http://localhost/herd/subherd/special")
+  >>> print browser.contents
+  special view
+
 """
 import grok
 



More information about the Checkins mailing list