[Zope3-checkins]
SVN: Zope3/trunk/src/zope/app/traversing/adapters.py
Converted XXX to TODO. Enhanced comment.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Fri Jul 9 11:46:10 EDT 2004
Log message for revision 26329:
Converted XXX to TODO. Enhanced comment.
-=-
Modified: Zope3/trunk/src/zope/app/traversing/adapters.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/adapters.py 2004-07-09 15:46:06 UTC (rev 26328)
+++ Zope3/trunk/src/zope/app/traversing/adapters.py 2004-07-09 15:46:09 UTC (rev 26329)
@@ -40,15 +40,18 @@
def traverse(self, name, furtherPath):
subject = self._subject
- r = getattr(subject, name, _marker)
- if r is not _marker:
- # XXX It is pretty obvious that we should call methods.
- # That much is expected from page templates.
- # What about classmethods / staticmethods / other descriptors?
- # What about methods that take several arguments?
- if getattr(r, '__class__', 0) == MethodType:
- return r()
- return r
+ attr = getattr(subject, name, _marker)
+ if attr is not _marker:
+ # TODO: It is pretty obvious that we should call methods.
+ # That much is expected from page templates.
+ # What about classmethods / staticmethods / other descriptors?
+ # What about methods that take several arguments?
+ # We should probably use the inspect module here. The bit about
+ # methods taking arguments is tricky. Maybe it should just not be
+ # allowed.
+ if getattr(attr, '__class__', 0) == MethodType:
+ return attr()
+ return attr
if hasattr(subject, '__getitem__'):
# Let exceptions propagate.
More information about the Zope3-Checkins
mailing list