[Zope-Checkins] SVN: Zope/trunk/src/ZPublisher/BaseRequest.py Better check of "in" support

Partick Gerken cvs-admin at zope.org
Mon Jul 23 10:39:38 UTC 2012


Log message for revision 127374:
  Better check of "in" support
  
  To be sure that "in" is supported
  I'd have to check for multiple possible
  builtin attributes. Instead I do a try 
  except.
  

Changed:
  U   Zope/trunk/src/ZPublisher/BaseRequest.py

-=-
Modified: Zope/trunk/src/ZPublisher/BaseRequest.py
===================================================================
--- Zope/trunk/src/ZPublisher/BaseRequest.py	2012-07-23 10:37:49 UTC (rev 127373)
+++ Zope/trunk/src/ZPublisher/BaseRequest.py	2012-07-23 10:39:34 UTC (rev 127374)
@@ -541,9 +541,12 @@
             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



More information about the Zope-Checkins mailing list