[Checkins] SVN: grokui.admin/branches/0.4/ Port traverser-bugfix from 0.3 series.

Uli Fouquet uli at gnufix.de
Sun Feb 14 08:19:40 EST 2010


Log message for revision 109039:
  Port traverser-bugfix from 0.3 series.

Changed:
  U   grokui.admin/branches/0.4/CHANGES.txt
  U   grokui.admin/branches/0.4/src/grokui/admin/objectinfo.py
  U   grokui.admin/branches/0.4/src/grokui/admin/tests/objectbrowser.py

-=-
Modified: grokui.admin/branches/0.4/CHANGES.txt
===================================================================
--- grokui.admin/branches/0.4/CHANGES.txt	2010-02-14 13:18:47 UTC (rev 109038)
+++ grokui.admin/branches/0.4/CHANGES.txt	2010-02-14 13:19:40 UTC (rev 109039)
@@ -4,6 +4,12 @@
 0.4.1 (unreleased)
 ==================
 
+Bug fixes
+---------
+
+* Fixed bug in object browser: objects that 'booleanized' evaluated to
+  ``False`` (empty containers for instance) were not displayed.
+
 0.4 (2009-08-21)
 ================
 

Modified: grokui.admin/branches/0.4/src/grokui/admin/objectinfo.py
===================================================================
--- grokui.admin/branches/0.4/src/grokui/admin/objectinfo.py	2010-02-14 13:18:47 UTC (rev 109038)
+++ grokui.admin/branches/0.4/src/grokui/admin/objectinfo.py	2010-02-14 13:19:40 UTC (rev 109039)
@@ -304,7 +304,7 @@
                 new_obj = self.obj[name]
 
         # Try to get name as sequence entry...
-        if not new_obj:
+        if new_obj is None:
             # This is not the appropriate way to handle iterators. We
             # must find somehing to handle them too.
             try:
@@ -315,11 +315,11 @@
                 pass
 
         # Get name as obj attribute...
-        if not new_obj and hasattr(self.obj, name):
+        if new_obj is None and hasattr(self.obj, name):
             new_obj = getattr(self.obj, name, None)
 
         # Get name as annotation...
-        if not new_obj:
+        if new_obj is None:
             naked = zope.security.proxy.removeSecurityProxy(self.obj)
             try:
                 annotations = IAnnotations(naked)
@@ -330,7 +330,7 @@
                 pass
 
         # Give obj a location...
-        if new_obj:
+        if new_obj is not None:
             if not IPhysicallyLocatable(new_obj, False):
                 new_obj = location.LocationProxy(
                     new_obj, self.obj, name)

Modified: grokui.admin/branches/0.4/src/grokui/admin/tests/objectbrowser.py
===================================================================
--- grokui.admin/branches/0.4/src/grokui/admin/tests/objectbrowser.py	2010-02-14 13:18:47 UTC (rev 109038)
+++ grokui.admin/branches/0.4/src/grokui/admin/tests/objectbrowser.py	2010-02-14 13:19:40 UTC (rev 109039)
@@ -130,7 +130,29 @@
   ...   <a href="http://localhost/docgrok-obj/data/@@inspect.html">&lt;BTrees.OOBTree.OOBTree object at ...&gt;</a>
   ... </div>
   ...
-  
 
 
+Traversing objects whose boolean value evaluates to ``False``
+-------------------------------------------------------------
+
+Due to a faulty traverser in former versions objects which evaluated
+to ``False`` when 'booleanized', empty containers for example, one
+could not browse those object.
+
+When we create an empty container:
+
+  >>> import grok
+  >>> mycontainer = grok.Container()
+  >>> getRootFolder()['mycontainer'] = mycontainer
+  >>> bool(mycontainer)
+  False
+
+we can browse it now:
+
+  >>> browser.open('http://localhost/docgrok-obj/mycontainer/@@inspect.html')
+  >>> print browser.contents
+  <html xmlns="http://www.w3.org/1999/xhtml">
+  ...<span>mycontainer</span>
+  ...<span>...<a ...>Container</a> object at 0x...</span>...
+
 """



More information about the checkins mailing list