[Zope-Checkins] CVS: Packages/OFS/tests -
testAppInitializer.py:1.1.2.3.4.1 testProductInit.py:1.1.2.2.30.1
Tres Seaver
tseaver at palladion.com
Sat May 28 20:42:12 EDT 2005
Update of /cvs-repository/Packages/OFS/tests
In directory cvs.zope.org:/tmp/cvs-serv32028/lib/python/OFS/tests
Modified Files:
Tag: tseaver-hasattr_geddon-branch
testAppInitializer.py testProductInit.py
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?
=== Packages/OFS/tests/testAppInitializer.py 1.1.2.3 => 1.1.2.3.4.1 ===
--- Packages/OFS/tests/testAppInitializer.py:1.1.2.3 Tue Jan 18 11:21:14 2005
+++ Packages/OFS/tests/testAppInitializer.py Sat May 28 20:41:31 2005
@@ -19,6 +19,7 @@
import Zope.Startup
import ZConfig
from App.config import getConfiguration, setConfiguration
+from ZODB.utils import safe_hasattr
TEMPNAME = tempfile.mktemp()
TEMPPRODUCTS = os.path.join(TEMPNAME, "Products")
@@ -94,9 +95,9 @@
i = self.getOne()
app = i.getApp()
i.install_cp_and_products()
- self.failUnless(hasattr(app, 'Control_Panel'))
+ self.failUnless(safe_hasattr(app, 'Control_Panel'))
self.assertEqual(app.Control_Panel.meta_type, 'Control Panel')
- self.failUnless(hasattr(app.Control_Panel, 'Products'))
+ self.failUnless(safe_hasattr(app.Control_Panel, 'Products'))
self.assertEqual(app.Control_Panel.Products.meta_type,
'Product Management')
@@ -216,7 +217,7 @@
self.assertEqual(app.standard_html_footer.meta_type, 'DTML Method')
self.assertEqual(getattr(app, 'standard_template.pt').meta_type,
'Page Template')
- self.failUnless(hasattr(app, '_standard_objects_have_been_added'))
+ self.failUnless(safe_hasattr(app, '_standard_objects_have_been_added'))
def test_suite():
=== Packages/OFS/tests/testProductInit.py 1.1.2.2 => 1.1.2.2.30.1 ===
--- Packages/OFS/tests/testProductInit.py:1.1.2.2 Thu Jan 15 22:07:32 2004
+++ Packages/OFS/tests/testProductInit.py Sat May 28 20:41:31 2005
@@ -15,6 +15,7 @@
import os, sys, unittest, tempfile, shutil, cStringIO
import ZODB
+from ZODB.utils import safe_hasattr
from OFS.Application import Application, AppInitializer, get_products
import Zope.Startup
import ZConfig
@@ -190,7 +191,7 @@
# initialize is called
self.assert_(os.path.exists(doneflag))
# Methods installed into folder
- self.assert_(hasattr(Folder, 'amethod'))
+ self.assert_(safe_hasattr(Folder, 'amethod'))
# __ac_permissions__ put into folder
self.assert_( ('aPermission', (),) in
Folder.__ac_permissions__)
More information about the Zope-Checkins
mailing list