[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/appsetup/ Make sure we can bootstrap named utility

Roger Ineichen roger at projekt01.ch
Sat Nov 4 20:16:18 EST 2006


Log message for revision 71075:
  Make sure we can bootstrap named utility

Changed:
  U   Zope3/trunk/src/zope/app/appsetup/bootstrap.py
  U   Zope3/trunk/src/zope/app/appsetup/tests.py

-=-
Modified: Zope3/trunk/src/zope/app/appsetup/bootstrap.py
===================================================================
--- Zope3/trunk/src/zope/app/appsetup/bootstrap.py	2006-11-04 20:41:28 UTC (rev 71074)
+++ Zope3/trunk/src/zope/app/appsetup/bootstrap.py	2006-11-05 01:16:14 UTC (rev 71075)
@@ -74,7 +74,7 @@
         
     sm = root_folder.getSiteManager()
     utils = [reg for reg in sm.registeredUtilities()
-             if reg.provided.isOrExtends(interface)]
+             if (reg.provided.isOrExtends(interface) and reg.name == name)]
     if len(utils) == 0:
         return addConfigureUtility(
             root_folder, interface, utility_type, utility_factory,

Modified: Zope3/trunk/src/zope/app/appsetup/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/appsetup/tests.py	2006-11-04 20:41:28 UTC (rev 71074)
+++ Zope3/trunk/src/zope/app/appsetup/tests.py	2006-11-05 01:16:14 UTC (rev 71075)
@@ -121,16 +121,23 @@
         for i in range(2):
             cx = self.db.open()
             utility = ensureUtility(root_folder, IErrorReportingUtility,
-                                 'ErrorReporting', ErrorReportingUtility,
-                                 'ErrorReporting', asObject=True)
+                                    'ErrorReporting', ErrorReportingUtility,
+                                    'ErrorReporting', asObject=True)
+            utility2 = ensureUtility(root_folder, IErrorReportingUtility,
+                                     'ErrorReporting2', ErrorReportingUtility,
+                                     'ErrorReporting2', asObject=True)
             if utility != None:
                 name = utility.__name__
+                name2 = utility2.__name__
             else:
                 name = None
+                name2 = None
             if i == 0:
                 self.assertEqual(name, 'ErrorReporting')
+                self.assertEqual(name2, 'ErrorReporting2')
             else:
                 self.assertEqual(name, None)
+                self.assertEqual(name2, None)
 
             root = cx.root()
             root_folder = root[ZopePublication.root_name]
@@ -140,6 +147,8 @@
 
             self.assert_(IErrorReportingUtility.providedBy(
                 traverse(package, 'ErrorReporting')))
+            self.assert_(IErrorReportingUtility.providedBy(
+                traverse(package, 'ErrorReporting2')))
             transaction.commit()
 
         cx.close()



More information about the Zope3-Checkins mailing list