[Zope-Checkins] CVS: Zope/lib/python/Products/Sessions - SessionDataManager.py:1.23.68.1

Chris McDonough chrism at plope.com
Wed May 19 21:07:24 EDT 2004


Update of /cvs-repository/Zope/lib/python/Products/Sessions
In directory cvs.zope.org:/tmp/cvs-serv18414

Modified Files:
      Tag: Zope-2_7-branch
	SessionDataManager.py 
Log Message:
Remove some hasattr calls in favor of getattr in order to prevent conflicts.


=== Zope/lib/python/Products/Sessions/SessionDataManager.py 1.23 => 1.23.68.1 ===
--- Zope/lib/python/Products/Sessions/SessionDataManager.py:1.23	Tue Aug 20 11:08:48 2002
+++ Zope/lib/python/Products/Sessions/SessionDataManager.py	Wed May 19 21:07:23 2004
@@ -178,7 +178,8 @@
         """ returns new or existing session data object """
         container = self._getSessionDataContainer()
         ob = container.new_or_existing(key)
-        if hasattr(ob, '__of__') and hasattr(ob, 'aq_parent'):
+        # hasattr hides conflicts
+        if getattr(ob, '__of__', None) and getattr(ob, 'aq_parent', None):
             # splice ourselves into the acquisition chain
             return ob.__of__(self.__of__(ob.aq_parent))
         return ob.__of__(self)
@@ -188,7 +189,8 @@
         container = self._getSessionDataContainer()
         ob = container.get(key)
         if ob is not None:
-            if hasattr(ob, '__of__') and hasattr(ob, 'aq_parent'):
+            # hasattr hides conflicts
+            if getattr(ob, '__of__', None) and getattr(ob, 'aq_parent', None):
                 # splice ourselves into the acquisition chain
                 return ob.__of__(self.__of__(ob.aq_parent))
             return ob.__of__(self)
@@ -205,7 +207,8 @@
             # currently fails for mounted storages.  This might
             # be construed as a security hole, albeit a minor one.
             # unrestrictedTraverse is also much faster.
-            if DEBUG and not hasattr(self, '_v_wrote_dc_type'):
+            # hasattr hides conflicts
+            if DEBUG and not getattr(self, '_v_wrote_dc_type', None):
                 args = string.join(self.obpath, '/')
                 LOG('Session Tracking', BLATHER,
                     'External data container at %s in use' % args)




More information about the Zope-Checkins mailing list