[Zope3-checkins] SVN: Zope3/trunk/src/zope/ Merged
Zope3/branches/faassen-interfaces 24617:24640. Since
src/zope/interface/_zope_interface_coptimizations.c
Martijn Faassen
m.faassen at vet.uu.nl
Fri May 14 06:41:08 EDT 2004
Log message for revision 24641:
Merged Zope3/branches/faassen-interfaces 24617:24640. Since src/zope/interface/_zope_interface_coptimizations.c
changed, you need to recompile your checkouts.
-=-
Modified: Zope3/trunk/src/zope/app/interface/tests/test_interface.py
===================================================================
--- Zope3/trunk/src/zope/app/interface/tests/test_interface.py 2004-05-14 05:29:58 UTC (rev 24640)
+++ Zope3/trunk/src/zope/app/interface/tests/test_interface.py 2004-05-14 10:41:07 UTC (rev 24641)
@@ -22,9 +22,10 @@
from ZODB.tests.util import DB
from zodbcode.module import ManagedRegistry
-from zope.interface import Interface
+from zope.interface import Interface, implements
from zope.app.interface import PersistentInterface
+# XXX for some reason changing this code to use implements() does not work
code = """\
from zope.interface import Interface
@@ -32,7 +33,7 @@
pass
class Foo:
- __implements__ = IFoo
+ __implemented__ = IFoo
aFoo = Foo()
"""
@@ -54,7 +55,7 @@
pass
class Foo:
- __implements__ = IFoo
+ implements(IFoo)
self.assert_(IFoo.providedBy(Foo()))
self.assertEqual(IFoo._p_oid, None)
@@ -65,7 +66,7 @@
imodule = self.registry.findModule("imodule")
# test for a pickling bug
- self.assertEqual(imodule.Foo.__implements__, imodule.IFoo)
+ self.assertEqual(imodule.Foo.__implemented__, imodule.IFoo)
self.assert_(imodule.IFoo.providedBy(imodule.aFoo))
# the conversion should not affect Interface
Modified: Zope3/trunk/src/zope/interface/_zope_interface_coptimizations.c
===================================================================
--- Zope3/trunk/src/zope/interface/_zope_interface_coptimizations.c 2004-05-14 05:29:58 UTC (rev 24640)
+++ Zope3/trunk/src/zope/interface/_zope_interface_coptimizations.c 2004-05-14 10:41:07 UTC (rev 24641)
@@ -19,7 +19,7 @@
#define OBJECT(O) ((PyObject*)(O))
#define CLASSIC(O) ((PyClassObject*)(O))
-static PyObject *str__dict__, *str__implements__, *strextends;
+static PyObject *str__dict__, *str__implemented__, *strextends;
static PyObject *BuiltinImplementationSpecifications, *str__provides__;
static PyObject *str__class__, *str__providedBy__, *strisOrExtends;
static PyObject *empty, *fallback, *str_implied, *str_cls, *str_implements;
@@ -106,7 +106,7 @@
return implementedByFallback(cls);
}
- spec = PyObject_GetItem(dict, str__implements__);
+ spec = PyObject_GetItem(dict, str__implemented__);
Py_DECREF(dict);
if (spec)
{
@@ -509,7 +509,7 @@
if(! (str ## S = PyString_FromString(# S))) return
DEFINE_STRING(__dict__);
- DEFINE_STRING(__implements__);
+ DEFINE_STRING(__implemented__);
DEFINE_STRING(__provides__);
DEFINE_STRING(__class__);
DEFINE_STRING(__providedBy__);
Modified: Zope3/trunk/src/zope/interface/declarations.py
===================================================================
--- Zope3/trunk/src/zope/interface/declarations.py 2004-05-14 05:29:58 UTC (rev 24640)
+++ Zope3/trunk/src/zope/interface/declarations.py 2004-05-14 10:41:07 UTC (rev 24641)
@@ -292,7 +292,7 @@
# This also manages storage of implementation specifications
try:
- spec = cls.__dict__.get('__implements__')
+ spec = cls.__dict__.get('__implemented__')
except AttributeError:
# we can't get the class dict. This is probably due to a
@@ -305,7 +305,7 @@
# We'll check to see if there's an implements:
- spec = getattr(cls, '__implements__', None)
+ spec = getattr(cls, '__implemented__', None)
if spec is None:
return _empty
if spec.__class__ == Implements:
@@ -313,7 +313,8 @@
# Return it.
return spec
- # Hm, there's an __implements__, but it's not a spec. Must be
+ # XXX need old style __implements__ compatibility?
+ # Hm, there's an __implemented__, but it's not a spec. Must be
# an old-style declaration. Just compute a spec for it
return Declaration(*_normalizeargs((spec, )))
@@ -325,12 +326,13 @@
if spec is not None:
return spec
+ # XXX need old style __implements__ comptability?
if spec is not None:
- # old-style __implements__ = foo declaration
+ # old-style __implemented__ = foo declaration
spec = (spec, ) # tuplefy, as it might be just an int
spec = Implements(*_normalizeargs(spec))
spec.inherit = None # old-style implies no inherit
- del cls.__implements__ # get rid of the old-style declaration
+ del cls.__implemented__ # get rid of the old-style declaration
else:
try:
bases = cls.__bases__
@@ -343,7 +345,7 @@
spec.__name__ = getattr(cls, '__module__', '?') + '.' + cls.__name__
try:
- cls.__implements__ = spec
+ cls.__implemented__ = spec
if not hasattr(cls, '__providedBy__'):
cls.__providedBy__ = objectSpecificationDescriptor
@@ -1069,7 +1071,7 @@
...
>>> class A: implements(I1)
...
- >>> class B: __implements__ = I2
+ >>> class B: __implemented__ = I2
...
>>> class C(A, B): implements(I31)
...
Modified: Zope3/trunk/src/zope/interface/interface.py
===================================================================
--- Zope3/trunk/src/zope/interface/interface.py 2004-05-14 05:29:58 UTC (rev 24640)
+++ Zope3/trunk/src/zope/interface/interface.py 2004-05-14 10:41:07 UTC (rev 24641)
@@ -808,7 +808,7 @@
# We can't say this yet because we don't have enough
# infrastructure in place.
#
- #__implements__ = IAttribute
+ #__implemented__ = IAttribute
class Method(Attribute):
"""Method interfaces
@@ -820,7 +820,7 @@
# We can't say this yet because we don't have enough
# infrastructure in place.
#
- #__implements__ = IMethod
+ #__implemented__ = IMethod
interface=''
Modified: Zope3/trunk/src/zope/interface/tests/test_declarations.py
===================================================================
--- Zope3/trunk/src/zope/interface/tests/test_declarations.py 2004-05-14 05:29:58 UTC (rev 24640)
+++ Zope3/trunk/src/zope/interface/tests/test_declarations.py 2004-05-14 10:41:07 UTC (rev 24641)
@@ -39,7 +39,7 @@
implementsOnly(I3)
class COnly_old(A, B):
- __implements__ = I3
+ __implemented__ = I3
class D(COnly):
implements(I5)
@@ -76,11 +76,11 @@
def test_backward_compat(self):
- class C1: __implements__ = I1
- class C2(C1): __implements__ = I2, I5
- class C3(C2): __implements__ = I3, C2.__implements__
+ class C1: __implemented__ = I1
+ class C2(C1): __implemented__ = I2, I5
+ class C3(C2): __implemented__ = I3, C2.__implemented__
- self.assert_(C3.__implements__.__class__ is tuple)
+ self.assert_(C3.__implemented__.__class__ is tuple)
self.assertEqual(
[i.getName() for i in providedBy(C3())],
@@ -96,16 +96,16 @@
)
self.assertEqual(
- [i.getName() for i in C4.__implements__],
+ [i.getName() for i in C4.__implemented__],
['I4', 'I3', 'I2', 'I5'],
)
- # Note that C3.__implements__ should now be a sequence of interfaces
+ # Note that C3.__implemented__ should now be a sequence of interfaces
self.assertEqual(
- [i.getName() for i in C3.__implements__],
+ [i.getName() for i in C3.__implemented__],
['I3', 'I2', 'I5'],
)
- self.failIf(C3.__implements__.__class__ is tuple)
+ self.failIf(C3.__implemented__.__class__ is tuple)
def test_module(self):
import zope.interface.tests.m1
Modified: Zope3/trunk/src/zope/interface/tests/test_odd_declarations.py
===================================================================
--- Zope3/trunk/src/zope/interface/tests/test_odd_declarations.py 2004-05-14 05:29:58 UTC (rev 24640)
+++ Zope3/trunk/src/zope/interface/tests/test_odd_declarations.py 2004-05-14 10:41:07 UTC (rev 24641)
@@ -33,7 +33,7 @@
class Odd: __metaclass__ = odd.MetaClass
-class B(Odd): __implements__ = I2
+class B(Odd): __implemented__ = I2
# XXX We are going to need more magic to make classProvides work with odd
@@ -87,7 +87,7 @@
self.assert_(providedBy(c).extends(I31))
self.assert_(providedBy(c).extends(I5))
- class COnly(A, B): __implements__ = I31
+ class COnly(A, B): __implemented__ = I31
class D(COnly):
implements(I5)
Modified: Zope3/trunk/src/zope/interface/tests/unitfixtures.py
===================================================================
--- Zope3/trunk/src/zope/interface/tests/unitfixtures.py 2004-05-14 05:29:58 UTC (rev 24640)
+++ Zope3/trunk/src/zope/interface/tests/unitfixtures.py 2004-05-14 10:41:07 UTC (rev 24641)
@@ -42,7 +42,7 @@
-C.__implements__=IC
+C.__implemented__=IC
class I1(Interface):
def ma():
@@ -55,15 +55,15 @@
class I4(Interface): pass
class A(I1.deferred()):
- __implements__=I1
+ __implemented__=I1
class B:
- __implements__=I2, I3
+ __implemented__=I2, I3
class D(A, B): pass
class E(A, B):
- __implements__ = A.__implements__, C.__implements__
+ __implemented__ = A.__implemented__, C.__implemented__
class FooInterface(Interface):
@@ -86,7 +86,7 @@
class Foo:
""" A concrete class """
- __implements__ = FooInterface,
+ __implemented__ = FooInterface,
foobar = "yeah"
Modified: Zope3/trunk/src/zope/interface/type.py
===================================================================
--- Zope3/trunk/src/zope/interface/type.py 2004-05-14 05:29:58 UTC (rev 24640)
+++ Zope3/trunk/src/zope/interface/type.py 2004-05-14 10:41:07 UTC (rev 24641)
@@ -140,7 +140,7 @@
def getAllForObject(self, object):
# XXX This isn't quite right, since it doesn't take into
# account implementation registries for objects that can't
- # have '__implements__' attributes.
+ # have '__implemented__' attributes.
return self.getAll(providedBy(object))
def getTypesMatching(self, interface):
More information about the Zope3-Checkins
mailing list