Skip to content

Commit

Permalink
Better check of "in" support
Browse files Browse the repository at this point in the history
To be sure that "in" is supported
I'd have to check for multiple possible
builtin attributes. Instead I do a try 
except.
  • Loading branch information
do3cc committed Jul 23, 2012
1 parent 6a67376 commit b457ffc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ZPublisher/BaseRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,12 @@ def traverse(self, path, response=None, validated_hook=None):
hasattr(parents[1], 'aq_base') and
not hasattr(parents[1],'__bobo_traverse__')):
base = parents[1].aq_base
if not (hasattr(base, entry_name) or entry_name in base
(hasattr(base, '__iter__') and entry_name in base)):
raise AttributeError(entry_name)
if not hasattr(base, entry_name):
try:
if not entry_name in base:
raise AttributeError(entry_name)
except TypeError:
raise AttributeError(entry_name)

# After traversal post traversal hooks aren't available anymore
del self._post_traverse
Expand Down

0 comments on commit b457ffc

Please sign in to comment.