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

Partick Gerken <[email protected]> Mon, 23 Jul 2012 06:37:55 -0400 (EDT)
Newsgroups gmane.comp.web.zope.cvs
Message-ID <[email protected]>
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

_______________________________________________
Zope-Checkins maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-checkins