[Zope3-checkins] CVS: Zope3/src/zope/interface - _zope_interface_coptimizations.c:1.6.2.1 declarations.py:1.22.2.1 interface.py:1.25.2.1 type.py:1.13.2.1

Martijn Faassen m.faassen at vet.uu.nl
Fri May 7 06:37:08 EDT 2004


Update of /cvs-repository/Zope3/src/zope/interface
In directory cvs.zope.org:/tmp/cvs-serv4538/src/zope/interface

Modified Files:
      Tag: faassen-interfaces-branch
	_zope_interface_coptimizations.c declarations.py interface.py 
	type.py 
Log Message:
Change __implements__ to __implemented__ to avoid clash with Zope 2
interfaces. The Zope 3 tests run; the Zope 2 integration still needs to be
tested further.

Note that this change destroys any backwards compatibility code to support
old style __implements__ usage. We need to decide whether this backwards
compatibility should go (my recommendation) or whether there are reasons
to keep supporting this. The one possible reason I can come up with is
FrankenZope, but this alternative form of Zope 3 integration into Zope 2
is supposed to make FrankenZope unnecessary.


=== Zope3/src/zope/interface/_zope_interface_coptimizations.c 1.6 => 1.6.2.1 ===
--- Zope3/src/zope/interface/_zope_interface_coptimizations.c:1.6	Mon May  3 16:31:27 2004
+++ Zope3/src/zope/interface/_zope_interface_coptimizations.c	Fri May  7 06:36:37 2004
@@ -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__);


=== Zope3/src/zope/interface/declarations.py 1.22 => 1.22.2.1 ===
--- Zope3/src/zope/interface/declarations.py:1.22	Fri Apr 30 13:37:10 2004
+++ Zope3/src/zope/interface/declarations.py	Fri May  7 06:36:37 2004
@@ -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)
         ...


=== Zope3/src/zope/interface/interface.py 1.25 => 1.25.2.1 ===
--- Zope3/src/zope/interface/interface.py:1.25	Fri Apr 30 13:37:10 2004
+++ Zope3/src/zope/interface/interface.py	Fri May  7 06:36:37 2004
@@ -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=''
 


=== Zope3/src/zope/interface/type.py 1.13 => 1.13.2.1 ===
--- Zope3/src/zope/interface/type.py:1.13	Tue Mar 30 17:01:34 2004
+++ Zope3/src/zope/interface/type.py	Fri May  7 06:36:37 2004
@@ -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