Update of /cvs-repository/Products/ZSQLMethods In directory cvs.zope.org:/tmp/cvs-serv32028/lib/python/Products/ZSQLMethods
Modified Files: Tag: tseaver-hasattr_geddon-branch SQL.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/ZSQLMethods/SQL.py 1.21 => 1.21.132.1 === --- Products/ZSQLMethods/SQL.py:1.21 Wed Aug 14 18:25:18 2002 +++ Products/ZSQLMethods/SQL.py Sat May 28 20:41:35 2005 @@ -18,6 +18,7 @@ import Shared.DC.ZRDB.DA from Globals import DTMLFile +from ZODB.utils import safe_hasattr from webdav.WriteLockInterface import WriteLockInterface def SQLConnectionIDs(self): @@ -30,17 +31,21 @@ StringType=type('') while self is not None: - if hasattr(self, 'objectValues'): + if safe_hasattr(self, 'objectValues'): for o in self.objectValues(): - if (hasattr(o,'_isAnSQLConnection') and o._isAnSQLConnection - and hasattr(o,'id')): + if (safe_hasattr(o,'_isAnSQLConnection') + and o._isAnSQLConnection + and safe_hasattr(o,'id')): id=o.id - if type(id) is not StringType: id=id() + if type(id) is not StringType: + id=id() if not have_id(id): - if hasattr(o,'title_and_id'): o=o.title_and_id() - else: o=id + if safe_hasattr(o,'title_and_id'): + o=o.title_and_id() + else: + o=id ids[id]=id - if hasattr(self, 'aq_parent'): self=self.aq_parent + if safe_hasattr(self, 'aq_parent'): self=self.aq_parent else: self=None ids=map(lambda item: (item[1], item[0]), ids.items()) @@ -48,9 +53,8 @@ return ids manage_addZSQLMethodForm=DTMLFile('dtml/add', globals()) -def manage_addZSQLMethod(self, id, title, - connection_id, arguments, template, - REQUEST=None, submit=None): +def manage_addZSQLMethod(self, id, title, connection_id, arguments, template, + REQUEST=None, submit=None): """Add an SQL Method The 'connection_id' argument is the id of a database connection _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins