[Zope-Checkins] CVS: Products/Sessions/tests - testSessionDataManager.py:

Tres Seaver tseaver at palladion.com
Sat May 28 20:42:14 EDT 2005

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

Modified Files:
      Tag: tseaver-hasattr_geddon-branch
Log Message:

  - Removed all uses of the 'hasattr' builtin from the core, where
    the object being tested derives (or might) from Persistent.
    XXX:  currently, this branch imports a 'safe_hasattr' from ZODB.utils,
    which adds a dependency on ZODB for some packages;  we probably
    need a better location, and perhas a C implementation?

=== Products/Sessions/tests/testSessionDataManager.py => ===
--- Products/Sessions/tests/testSessionDataManager.py:	Sat Aug  2 15:21:09 2003
+++ Products/Sessions/tests/testSessionDataManager.py	Sat May 28 20:41:33 2005
@@ -24,6 +24,7 @@
     TransientObjectContainer, TransientObject
 from Products.TemporaryFolder.TemporaryFolder import MountedTemporaryFolder
 from ZODB.POSException import InvalidObjectReference, ConflictError
+from ZODB.utils import safe_hasattr
 from DateTime import DateTime
 from unittest import TestCase, TestSuite, TextTestRunner, makeSuite
 import time, threading
@@ -145,7 +146,7 @@
         sdType = type(TransientObject(1))
         sd = self.app.session_data_manager.getSessionData()
         self.failUnless(type(aq_base(sd)) is sdType)
-        self.failUnless(not hasattr(sd, '_invalid'))
+        self.failUnless(not safe_hasattr(sd, '_invalid'))
     def testBrowserIdIsSet(self):
         sd = self.app.session_data_manager.getSessionData()

More information about the Zope-Checkins mailing list