[Zope-Checkins] CVS: Products/PythonScripts - PythonScript.py:1.46.2.10.26.1

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


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

Modified Files:
      Tag: tseaver-hasattr_geddon-branch
	PythonScript.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/PythonScripts/PythonScript.py 1.46.2.10 => 1.46.2.10.26.1 ===
--- Products/PythonScripts/PythonScript.py:1.46.2.10	Mon Mar 22 11:25:42 2004
+++ Products/PythonScripts/PythonScript.py	Sat May 28 20:41:33 2005
@@ -35,6 +35,7 @@
 from AccessControl.ZopeGuards import get_safe_globals, guarded_getattr
 from zLOG import LOG, ERROR, INFO, PROBLEM
 from zExceptions import Forbidden
+from ZODB.utils import safe_hasattr
 import Globals
 
 # Track the Python bytecode version
@@ -271,7 +272,7 @@
     def _makeFunction(self, dummy=0): # CMFCore.FSPythonScript uses dummy arg.
         self.ZCacheable_invalidate()
         self._compile()
-        if not (aq_parent(self) is None or hasattr(self, '_filepath')):
+        if not (aq_parent(self) is None or safe_hasattr(self, '_filepath')):
             # It needs a _filepath, and has an acquisition wrapper.
             self._filepath = self.get_filepath()
 



More information about the Zope-Checkins mailing list