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

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


Log message for revision 127373:
  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/branches/2.13/src/ZPublisher/BaseRequest.py

-=-
Modified: Zope/branches/2.13/src/ZPublisher/BaseRequest.py
===================================================================
--- Zope/branches/2.13/src/ZPublisher/BaseRequest.py	2012-07-23 09:23:23 UTC (rev 127372)
+++ Zope/branches/2.13/src/ZPublisher/BaseRequest.py	2012-07-23 10:37:49 UTC (rev 127373)
@@ -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 
-                (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