[Zope-Checkins]
SVN: Products.Five/branches/philikon-fix-lookup-priorities/tests/testing/fancycontent.py
On special attributes,
FancyContent's __bobo_traverse__ method doesn't
Philipp von Weitershausen
philikon at philikon.de
Sun Mar 12 13:22:05 EST 2006
Log message for revision 65922:
On special attributes, FancyContent's __bobo_traverse__ method doesn't
return attributes but raises errors. We want this for testing the behaviour
of existing __bobo_traverse__ methods.
Changed:
U Products.Five/branches/philikon-fix-lookup-priorities/tests/testing/fancycontent.py
-=-
Modified: Products.Five/branches/philikon-fix-lookup-priorities/tests/testing/fancycontent.py
===================================================================
--- Products.Five/branches/philikon-fix-lookup-priorities/tests/testing/fancycontent.py 2006-03-12 18:14:53 UTC (rev 65921)
+++ Products.Five/branches/philikon-fix-lookup-priorities/tests/testing/fancycontent.py 2006-03-12 18:22:05 UTC (rev 65922)
@@ -52,11 +52,19 @@
security = ClassSecurityInfo()
def __bobo_traverse__(self, REQUEST, name):
+ if name == 'raise-attributeerror':
+ raise AttributeError(name)
+ elif name == 'raise-keyerror':
+ raise KeyError(name)
+ elif name == 'raise-valueerror':
+ raise ValueError(name)
return FancyAttribute(name).__of__(self)
def get_size(self):
return 43
+InitializeClass(FancyContent)
+
# A copy of the above class used to demonstrate some baseline behavior
class NonTraversableFancyContent(SimpleItem):
"""A class that already comes with its own __bobo_traverse__ handler.
@@ -70,12 +78,18 @@
security = ClassSecurityInfo()
def __bobo_traverse__(self, REQUEST, name):
+ if name == 'raise-attributeerror':
+ raise AttributeError(name)
+ elif name == 'raise-keyerror':
+ raise KeyError(name)
+ elif name == 'raise-valueerror':
+ raise ValueError(name)
return FancyAttribute(name).__of__(self)
def get_size(self):
return 43
-InitializeClass(FancyContent)
+InitializeClass(NonTraversableFancyContent)
def manage_addFancyContent(self, id, REQUEST=None):
"""Add the fancy fancy content."""
More information about the Zope-Checkins
mailing list