[Zope3-checkins] CVS: Zope3/src/zope/component - adapter.py:1.10

Jim Fulton jim at zope.com
Thu Apr 8 10:41:18 EDT 2004


Update of /cvs-repository/Zope3/src/zope/component
In directory cvs.zope.org:/tmp/cvs-serv11185/src/zope/component

Modified Files:
	adapter.py 
Log Message:
Changed tests so that registration objects no-longer need to be
orderable, allowing us to get rid of __cmp__, which was only needed
for testing.


=== Zope3/src/zope/component/adapter.py 1.9 => 1.10 ===
--- Zope3/src/zope/component/adapter.py:1.9	Wed Apr  7 15:18:58 2004
+++ Zope3/src/zope/component/adapter.py	Thu Apr  8 10:41:17 2004
@@ -115,7 +115,7 @@
         >>> registry.lookup((R2, ), P1, '')
         'c2'
 
-        >>> registrations = list(registry.registrations())
+        >>> registrations = map(repr, registry.registrations())
         >>> registrations.sort()
         >>> for registration in registrations:
         ...    print registration
@@ -144,12 +144,12 @@
         
         >>> registry.subscribe((R1, ), P2, 'c1', 'd1')
         >>> registry.subscribe((R1, ), P2, 'c2', 'd2')
-        >>> subscriptions = list(registry.subscriptions((R2, ), P1))
+        >>> subscriptions = map(str, registry.subscriptions((R2, ), P1))
         >>> subscriptions.sort()
         >>> subscriptions
         ['c1', 'c2']
 
-        >>> registrations = list(registry.registrations())
+        >>> registrations = map(repr, registry.registrations())
         >>> registrations.sort()
         >>> for registration in registrations:
         ...    print registration
@@ -195,17 +195,6 @@
             self.value, self.doc,
             )
 
-    def __cmp__(self, other):
-        if self.__class__ != other.__class__:
-            return cmp(repr(self.__class__), repr(other.__class__))
-        
-        return cmp(
-            (self.required, self.provided, self.name,
-             self.value, self.doc),
-            (other.required, other.provided, other.name,
-             other.value, other.doc),
-            )
-
 class SubscriptionRegistration(object):
 
     def __init__(self, required, provided, value, doc):
@@ -219,13 +208,4 @@
             self.__class__.__name__,
             tuple([getattr(r, '__name__', None) for r in self.required]),
             self.provided.__name__, self.value, self.doc,
-            )
-
-    def __cmp__(self, other):
-        if self.__class__ != other.__class__:
-            return cmp(repr(self.__class__), repr(other.__class__))
-
-        return cmp(
-            (self.required, self.provided, self.value, self.doc),
-            (other.required, other.provided, other.value, other.doc),
             )




More information about the Zope3-Checkins mailing list