[z3-checkins] r5698 - in z3/Five/branch/dc-experiments: . tests
dreamcatcher at codespeak.net
dreamcatcher at codespeak.net
Mon Jul 26 16:46:27 MEST 2004
Author: dreamcatcher
Date: Mon Jul 26 16:46:27 2004
New Revision: 5698
Modified:
z3/Five/branch/dc-experiments/configure.zcml
z3/Five/branch/dc-experiments/fiveconfigure.py
z3/Five/branch/dc-experiments/tests/test_five.py
Log:
- If a base class is five:traversable *but* we have a __bobo_traverse__ method we *do* want to do the __fallback_traverse__ thing.
Modified: z3/Five/branch/dc-experiments/configure.zcml
==============================================================================
--- z3/Five/branch/dc-experiments/configure.zcml (original)
+++ z3/Five/branch/dc-experiments/configure.zcml Mon Jul 26 16:46:27 2004
@@ -36,6 +36,9 @@
provides="zope.app.traversing.browser.interfaces.IAbsoluteURL"
/>
+ <five:traversable class="OFS.SimpleItem.Item" />
+ <five:traversable class="OFS.ObjectManager.ObjectManager" />
+
<!-- make Zope 2's REQUEST implement the right thing -->
<five:implements class="ZPublisher.HTTPRequest.HTTPRequest"
interface="zope.publisher.interfaces.browser.IBrowserRequest" />
Modified: z3/Five/branch/dc-experiments/fiveconfigure.py
==============================================================================
--- z3/Five/branch/dc-experiments/fiveconfigure.py (original)
+++ z3/Five/branch/dc-experiments/fiveconfigure.py Mon Jul 26 16:46:27 2004
@@ -67,10 +67,15 @@
)
def classTraversable(class_):
- # if a class already has this attribute, it means it is either a
+ # If a class already has this attribute, it means it is either a
# subclass of api.Traversable or was already processed with this
- # directive; in either case, do nothing...
- if hasattr(class_, '__five_traversable__'):
+ # directive; in either case, do nothing... except in the case were
+ # the class overrides __bobo_traverse__ instead of getting it from
+ # a base class. In this case, we suppose that the class probably
+ # didn't bother with the base classes __bobo_traverse__ anyway and
+ # we step __fallback_traverse__.
+ if (hasattr(class_, '__five_traversable__') and
+ not class_.__dict__.has_key('__bobo_traverse__')):
return
if hasattr(class_, '__bobo_traverse__'):
Modified: z3/Five/branch/dc-experiments/tests/test_five.py
==============================================================================
--- z3/Five/branch/dc-experiments/tests/test_five.py (original)
+++ z3/Five/branch/dc-experiments/tests/test_five.py Mon Jul 26 16:46:27 2004
@@ -208,14 +208,16 @@
self.folder.manage_addProduct['FiveTest'].manage_addFancyContent(
'fancy')
- # check if z3-based view lookup works
- response = self.publish('/test_folder_1_/fancy/fancy')
- self.assertEquals("Fancy, fancy", response.getBody())
# check if the old bobo_traverse method can still kick in
response = self.publish('/test_folder_1_/fancy/something-else')
self.assertEquals('something-else', response.getBody())
+ # check if z3-based view lookup works
+ response = self.publish('/test_folder_1_/fancy/fancy')
+ self.assertEquals("Fancy, fancy", response.getBody())
+
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(FiveTestCase))
More information about the z3-checkins
mailing list