[Checkins]
SVN: zope.interface/branches/jw-annotate-implementers-on-module/
Produce information to receive with a grokking procedure (as
discussed
Jan-Wijbrand Kolman
jw at infrae.com
Wed Jun 6 09:25:04 EDT 2007
Log message for revision 76410:
Produce information to receive with a grokking procedure (as discussed
between Martijn and Jim at the sprint).
Changed:
A zope.interface/branches/jw-annotate-implementers-on-module/
U zope.interface/branches/jw-annotate-implementers-on-module/src/zope/interface/declarations.py
-=-
Copied: zope.interface/branches/jw-annotate-implementers-on-module (from rev 76404, zope.interface/trunk)
Modified: zope.interface/branches/jw-annotate-implementers-on-module/src/zope/interface/declarations.py
===================================================================
--- zope.interface/trunk/src/zope/interface/declarations.py 2007-06-06 12:53:18 UTC (rev 76404)
+++ zope.interface/branches/jw-annotate-implementers-on-module/src/zope/interface/declarations.py 2007-06-06 13:25:02 UTC (rev 76410)
@@ -495,6 +495,13 @@
raise TypeError("Can't use implementer with classes. Use one of "
"the class-declaration functions instead."
)
+
+ frame = sys._getframe(1)
+ implementers = frame.f_locals.get('__implementers__', None)
+ if implementers is None:
+ frame.f_locals['__implementers__'] = implementers = []
+ implementers.append(ob)
+
spec = Implements(*self.interfaces)
try:
ob.__implemented__ = spec
@@ -941,7 +948,7 @@
``I1`` is provided through the class, ``I2`` is directly provided
by the object:
-
+
>>> class C(object):
... implements(I1)
>>> c = C()
@@ -950,7 +957,7 @@
True
Remove I2 from c again:
-
+
>>> noLongerProvides(c, I2)
>>> I2.providedBy(c)
False
More information about the Checkins
mailing list