[Zope3-checkins] CVS: Zope3/src/zope/app/utility - tests.py:1.7
utility.py:1.2
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sat Apr 17 10:34:17 EDT 2004
Update of /cvs-repository/Zope3/src/zope/app/utility
In directory cvs.zope.org:/tmp/cvs-serv17003/src/zope/app/utility
Modified Files:
tests.py utility.py
Log Message:
Get rid of getRegisteredMatching().
=== Zope3/src/zope/app/utility/tests.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/utility/tests.py:1.6 Thu Apr 15 11:29:31 2004
+++ Zope3/src/zope/app/utility/tests.py Sat Apr 17 10:33:46 2004
@@ -194,25 +194,6 @@
self.assertEqual(utilities.getUtility(IFoo, name=name).foo(), gout)
- def test_getRegisteredMatching(self):
- self.test_local_utilities()
- utilities = getService(self.rootFolder, "Utilities")
- r = list(utilities.getRegisteredMatching())
- r.sort()
- path = "/++etc++site/default/foo"
- cr1 = utilities.queryRegistrationsFor(
- utility.UtilityRegistration("", IFoo, path))
- cr2 = utilities.queryRegistrationsFor(
- utility.UtilityRegistration("bob", IFoo, path))
- self.assertEqual(r, [(IFoo, "", cr1), (IFoo, "bob", cr2)])
- self.assertEqual(r[0][2].__parent__, utilities)
- self.assertEqual(r[1][2].__parent__, utilities)
- # Now test that an empty registry doesn't show up
- for cd in cr1.info(): # Remove everything from cr1
- cd['registration'].status = UnregisteredStatus
- self.assertEqual(bool(cr1), False)
- r = list(utilities.getRegisteredMatching())
- self.assertEqual(r, [(IFoo, "bob", cr2)])
def test_local_overrides(self):
# Make sure that a local utility service can override another
=== Zope3/src/zope/app/utility/utility.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/utility/utility.py:1.1 Thu Apr 15 11:29:31 2004
+++ Zope3/src/zope/app/utility/utility.py Sat Apr 17 10:33:46 2004
@@ -56,21 +56,6 @@
if next_utils.get(name) != util:
yield name, util
- def getRegisteredMatching(self, interface=None, name=None):
- # doomed lame depreceated method backward-compatibly lame
-
- L = []
- for stacks in self.stacks.itervalues():
- for ((s, w, reg_name, iface), stack) in stacks.iteritems():
- if not stack:
- continue
- if interface and not iface is interface:
- continue
- if name is not None and reg_name.find(name) < 0:
- continue
- L.append((iface, reg_name, stack))
-
- return L
class UtilityRegistration(ComponentRegistration):
More information about the Zope3-Checkins
mailing list