[z3-checkins] r25435 - z3/sqlos/trunk/Zope2/FiveSQLOS

jinty at codespeak.net jinty at codespeak.net
Thu Apr 6 12:04:09 CEST 2006


Author: jinty
Date: Thu Apr  6 12:04:07 2006
New Revision: 25435

Modified:
   z3/sqlos/trunk/Zope2/FiveSQLOS/wrapper.py
Log:
Fix an important bug that was uncovered by the changes to the testing harness in sqlos.

Modified: z3/sqlos/trunk/Zope2/FiveSQLOS/wrapper.py
==============================================================================
--- z3/sqlos/trunk/Zope2/FiveSQLOS/wrapper.py	(original)
+++ z3/sqlos/trunk/Zope2/FiveSQLOS/wrapper.py	Thu Apr  6 12:04:07 2006
@@ -25,6 +25,7 @@
 from zope.app.container.constraints import checkFactory
 from zope.interface import implements, providedBy, directlyProvides
 from sqlos.interfaces import ISQLObject, IISQLObject
+from zope.app.exception.interfaces import UserError
 
 from Products.FiveSQLOS.interfaces import IFiveSQLObject
 
@@ -80,10 +81,12 @@
             # Look for the SQLObject class our object is from, so get all
             # allowed factories
             for name, factory in zapi.getFactoriesFor(ISQLObject):
-                if checkFactory(self, None, factory):
+                if checkFactory(self.aq_parent, None, factory):
                     # get the sqlobject class
-                    factory = zapi.getUtility(IISQLObject, name)
-                    if obj.sqlmeta.table == factory.sqlmeta.table:
+                    utility = zapi.queryUtility(IISQLObject, name)
+                    if utility is None:
+                        continue
+                    if obj.sqlmeta.table == utility.sqlmeta.table:
                         # if the tables names are the same, we assume that the
                         # sqlobject is an instance of that class, perhaps that
                         # is wrong


More information about the z3-checkins mailing list