[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/component/ Fixed a bug in getAllUtilitiesRegisteredFor which appeared when there

Albertas Agejevas alga at pov.lt
Sat Jun 12 09:19:37 EDT 2004


Log message for revision 25389:
Fixed a bug in getAllUtilitiesRegisteredFor which appeared when there
were no utilities registered.

This fix was applied on trunk in rev 25361.



-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/component/tests/test_utilityservice.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/component/tests/test_utilityservice.py	2004-06-12 13:14:23 UTC (rev 25388)
+++ Zope3/branches/ZopeX3-3.0/src/zope/component/tests/test_utilityservice.py	2004-06-12 13:19:36 UTC (rev 25389)
@@ -143,8 +143,15 @@
         uts.remove(dummerUtility)
         uts.remove(dummerUtility)
         self.assertEqual(uts, [])
-        
 
+
+    def test_getAllUtilitiesRegisteredFor_empty(self):
+        us = getService(Utilities)
+        class IFoo(Interface):
+            pass
+        self.assertEqual(list(us.getAllUtilitiesRegisteredFor(IFoo)), [])
+
+
 def test_suite():
     return makeSuite(Test)
 

Modified: Zope3/branches/ZopeX3-3.0/src/zope/component/utility.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/component/utility.py	2004-06-12 13:14:23 UTC (rev 25388)
+++ Zope3/branches/ZopeX3-3.0/src/zope/component/utility.py	2004-06-12 13:19:36 UTC (rev 25389)
@@ -59,7 +59,7 @@
                 yield item
 
     def getAllUtilitiesRegisteredFor(self, interface):
-        return iter(self._null.get(('s', interface), ()))
+        return iter(self._null.get(('s', interface)) or ())
 
 class GlobalUtilityService(UtilityService, GlobalService):
 




More information about the Zope3-Checkins mailing list