[Zope3-checkins] SVN: Zope3/trunk/src/zope/component/ Fixed a bug
in getAllUtilitiesRegisteredFor which appeared when there
Albertas Agejevas
alga at pov.lt
Fri Jun 11 13:52:58 EDT 2004
Log message for revision 25361:
Fixed a bug in getAllUtilitiesRegisteredFor which appeared when there
were no utilities registered.
-=-
Modified: Zope3/trunk/src/zope/component/tests/test_utilityservice.py
===================================================================
--- Zope3/trunk/src/zope/component/tests/test_utilityservice.py 2004-06-11 17:50:42 UTC (rev 25360)
+++ Zope3/trunk/src/zope/component/tests/test_utilityservice.py 2004-06-11 17:52:57 UTC (rev 25361)
@@ -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/trunk/src/zope/component/utility.py
===================================================================
--- Zope3/trunk/src/zope/component/utility.py 2004-06-11 17:50:42 UTC (rev 25360)
+++ Zope3/trunk/src/zope/component/utility.py 2004-06-11 17:52:57 UTC (rev 25361)
@@ -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