[Zope3-checkins] SVN: Zope3/trunk/src/zope/component/ Added
representations for several components, so that I can use them
Stephan Richter
srichter at cosmos.phy.tufts.edu
Wed Feb 23 16:44:09 EST 2005
Log message for revision 29264:
Added representations for several components, so that I can use them
better in tests.
Changed:
U Zope3/trunk/src/zope/component/factory.py
U Zope3/trunk/src/zope/component/site.py
-=-
Modified: Zope3/trunk/src/zope/component/factory.py
===================================================================
--- Zope3/trunk/src/zope/component/factory.py 2005-02-23 21:17:19 UTC (rev 29263)
+++ Zope3/trunk/src/zope/component/factory.py 2005-02-23 21:44:09 UTC (rev 29264)
@@ -42,3 +42,6 @@
spec.__name__ = getattr(self._callable, '__name__', '[callable]')
return spec
return implementedBy(self._callable)
+
+ def __repr__(self):
+ return '<%s for %s>' %(self.__class__.__name__, `self._callable`)
Modified: Zope3/trunk/src/zope/component/site.py
===================================================================
--- Zope3/trunk/src/zope/component/site.py 2005-02-23 21:17:19 UTC (rev 29263)
+++ Zope3/trunk/src/zope/component/site.py 2005-02-23 21:44:09 UTC (rev 29264)
@@ -289,7 +289,10 @@
self.value, self.doc,
)
+ def __cmp__(self, other):
+ return cmp(self.__repr__(), other.__repr__())
+
class SubscriptionRegistration(object):
"""Registration for a subscription adapter."""
@@ -304,6 +307,10 @@
self.provided.__name__, self.value, self.doc,
)
+ def __cmp__(self, other):
+ return cmp(self.__repr__(), other.__repr__())
+
+
class UtilityRegistration(object):
def __init__(self, provided, name, component, doc):
@@ -317,4 +324,6 @@
getattr(self.component, '__name__', self.component), self.doc,
)
+ def __cmp__(self, other):
+ return cmp(self.__repr__(), other.__repr__())
More information about the Zope3-Checkins
mailing list