[Zope-Checkins] CVS: Products/SiteAccess -
AccessRule.py:1.5.12.1.28.1 SiteRoot.py:1.6.68.1.28.1
Tres Seaver
tseaver at palladion.com
Sat May 28 20:42:14 EDT 2005
Update of /cvs-repository/Products/SiteAccess
In directory cvs.zope.org:/tmp/cvs-serv32028/lib/python/Products/SiteAccess
Modified Files:
Tag: tseaver-hasattr_geddon-branch
AccessRule.py SiteRoot.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?
=== Products/SiteAccess/AccessRule.py 1.5.12.1 => 1.5.12.1.28.1 ===
--- Products/SiteAccess/AccessRule.py:1.5.12.1 Thu Jan 8 18:33:53 2004
+++ Products/SiteAccess/AccessRule.py Sat May 28 20:41:34 2005
@@ -7,6 +7,7 @@
from ZPublisher.BeforeTraverse import \
registerBeforeTraverse, unregisterBeforeTraverse, queryBeforeTraverse, \
NameCaller
+from ZODB.utils import safe_hasattr
import os
from cgi import escape
@@ -48,7 +49,7 @@
return MessageDialog(title='No Access Rule',
message='This object now has no Access Rule',
action='%s/manage_main' % REQUEST['URL1'])
- elif method_id and hasattr(self, method_id):
+ elif method_id and safe_hasattr(self, method_id):
rules = unregisterBeforeTraverse(self, 'AccessRule')
if rules:
try: del getattr(self, rules[0].name).icon
=== Products/SiteAccess/SiteRoot.py 1.6.68.1 => 1.6.68.1.28.1 ===
--- Products/SiteAccess/SiteRoot.py:1.6.68.1 Thu Jan 8 18:33:53 2004
+++ Products/SiteAccess/SiteRoot.py Sat May 28 20:41:34 2005
@@ -7,6 +7,7 @@
from OFS.SimpleItem import Item
from Acquisition import Implicit, ImplicitAcquisitionWrapper
from ExtensionClass import Base
+from ZODB.utils import safe_hasattr
from ZPublisher import BeforeTraverse
import os
from cgi import escape
@@ -32,7 +33,7 @@
def manage_addToContainer(self, container, nextURL=''):
if nextURL:
- if hasattr(getattr(container, 'aq_base', container), self.id):
+ if safe_hasattr(getattr(container, 'aq_base', container), self.id):
return MessageDialog(title='Item Exists',
message='This object already contains a %s'
% escape(self.meta_type),
More information about the Zope-Checkins
mailing list