[Zope-Checkins] CVS: Packages/Shared/DC/Scripts -
Bindings.py:1.9.68.4.26.1
Tres Seaver
tseaver at palladion.com
Sat May 28 20:42:16 EDT 2005
Update of /cvs-repository/Packages/Shared/DC/Scripts
In directory cvs.zope.org:/tmp/cvs-serv32028/lib/python/Shared/DC/Scripts
Modified Files:
Tag: tseaver-hasattr_geddon-branch
Bindings.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/Shared/DC/Scripts/Bindings.py 1.9.68.4 => 1.9.68.4.26.1 ===
--- Packages/Shared/DC/Scripts/Bindings.py:1.9.68.4 Tue Jan 27 14:27:45 2004
+++ Packages/Shared/DC/Scripts/Bindings.py Sat May 28 20:41:36 2005
@@ -17,6 +17,7 @@
from AccessControl import getSecurityManager
from AccessControl.ZopeGuards import guarded_getattr
from Persistence import Persistent
+from ZODB.utils import safe_hasattr
from string import join, strip
import re
@@ -213,7 +214,7 @@
return names
def getBindingAssignments(self):
- if not hasattr(self, '_bind_names'):
+ if not safe_hasattr(self, '_bind_names'):
self._setupBindings()
return self._bind_names
@@ -221,7 +222,7 @@
path = request['TraversalRequestNameStack']
names = self.getBindingAssignments()
if (not names.isNameAssigned('name_subpath') or
- (path and hasattr(self.aq_base, path[-1])) ):
+ (path and safe_hasattr(self.aq_base, path[-1])) ):
return
subpath = path[:]
path[:] = []
@@ -282,7 +283,7 @@
def _getTraverseSubpath(self):
# Utility for bindcode.
- if hasattr(self, 'REQUEST'):
+ if safe_hasattr(self, 'REQUEST'):
return self.REQUEST.other.get('traverse_subpath', [])
else:
return []
More information about the Zope-Checkins
mailing list