[Checkins] SVN: zope.copypastemove/trunk/ Drop support for Python 2.4 and 2.5.

Tres Seaver cvs-admin at zope.org
Fri May 18 14:03:50 UTC 2012


Log message for revision 126103:
  Drop support for Python 2.4 and 2.5.
  
  Replace deprecated 'zope.component.adapts' usage with equivalent
  'zope.component.adapter' decorator.
  
  Replace deprecated 'zope.interface.implements' usage with equivalent
  'zope.interface.implementer' decorator.
  
  

Changed:
  U   zope.copypastemove/trunk/CHANGES.txt
  U   zope.copypastemove/trunk/setup.py
  U   zope.copypastemove/trunk/src/zope/copypastemove/__init__.py
  U   zope.copypastemove/trunk/src/zope/copypastemove/interfaces.py
  U   zope.copypastemove/trunk/src/zope/copypastemove/tests/test_rename.py

-=-
Modified: zope.copypastemove/trunk/CHANGES.txt
===================================================================
--- zope.copypastemove/trunk/CHANGES.txt	2012-05-18 14:01:12 UTC (rev 126102)
+++ zope.copypastemove/trunk/CHANGES.txt	2012-05-18 14:03:46 UTC (rev 126103)
@@ -2,9 +2,17 @@
 CHANGES
 =======
 
-3.9.0 (unreleased)
+4.0.0 (unreleased)
 ------------------
 
+- Replaced deprecated ``zope.component.adapts`` usage with equivalent
+  ``zope.component.adapter`` decorator.
+
+- Replaced deprecated ``zope.interface.implements`` usage with equivalent
+  ``zope.interface.implementer`` decorator.
+
+- Dropped support for Python 2.4 and 2.5.
+
 - Include zcml dependencies in configure.zcml, require the necessary packages
   via a zcml extra, added tests for zcml.
 

Modified: zope.copypastemove/trunk/setup.py
===================================================================
--- zope.copypastemove/trunk/setup.py	2012-05-18 14:01:12 UTC (rev 126102)
+++ zope.copypastemove/trunk/setup.py	2012-05-18 14:03:46 UTC (rev 126103)
@@ -17,7 +17,7 @@
 # Zope Toolkit policies as described by this documentation.
 ##############################################################################
 
-version = '3.9.0dev'
+version = '4.0.0dev'
 
 from setuptools import setup, find_packages
 
@@ -37,6 +37,9 @@
                    'Intended Audience :: Developers',
                    'License :: OSI Approved :: Zope Public License',
                    'Programming Language :: Python',
+                   'Programming Language :: Python :: 2',
+                   'Programming Language :: Python :: 2.6',
+                   'Programming Language :: Python :: 2.7',
                    'Framework :: Zope3',
                    ],
 

Modified: zope.copypastemove/trunk/src/zope/copypastemove/__init__.py
===================================================================
--- zope.copypastemove/trunk/src/zope/copypastemove/__init__.py	2012-05-18 14:01:12 UTC (rev 126102)
+++ zope.copypastemove/trunk/src/zope/copypastemove/__init__.py	2012-05-18 14:03:46 UTC (rev 126103)
@@ -16,9 +16,9 @@
 __docformat__ = 'restructuredtext'
 
 import zope.component
-from zope.interface import implements, Invalid
+from zope.interface import implementer, Invalid
 from zope.exceptions import DuplicationError
-from zope.component import adapts
+from zope.component import adapter
 from zope.copy import copy
 from zope.event import notify
 from zope.location.interfaces import ISublocations
@@ -38,6 +38,8 @@
 from zope.container.interfaces import INameChooser
 from zope.container.constraints import checkObject
 
+ at adapter(IContained)
+ at implementer(IObjectMover)
 class ObjectMover(object):
     """Adapter for moving objects between containers
 
@@ -130,8 +132,8 @@
     ...     __setitem__.precondition = preNoZ
 
     >>> from zope.container.interfaces import IContainer
-    >>> class C1(object):
-    ...     zope.interface.implements(I1, IContainer)
+    >>> @zope.interface.implementer(I1, IContainer)
+    ... class C1(object):
     ...     def __repr__(self):
     ...         return 'C1'
 
@@ -153,8 +155,8 @@
     >>> class I2(zope.interface.Interface):
     ...     __parent__ = zope.schema.Field(constraint=con1)
     ...
-    >>> class constrainedObject(object):
-    ...     zope.interface.implements(I2)
+    >>> @zope.interface.implementer(I2)
+    ... class constrainedObject(object):
     ...     def __init__(self):
     ...         self.__name__ = 'constrainedObject'
     ...
@@ -168,10 +170,6 @@
 
     """
 
-    adapts(IContained)
-
-    implements(IObjectMover)
-
     def __init__(self, object):
         self.context = object
         self.__parent__ = object # TODO: see if we can automate this
@@ -224,6 +222,8 @@
             return False
         return True
 
+ at adapter(IContained)
+ at implementer(IObjectCopier)
 class ObjectCopier(object):
     """Adapter for copying objects between containers
 
@@ -326,8 +326,8 @@
     ...     __setitem__.precondition = preNoZ
 
     >>> from zope.container.interfaces import IContainer
-    >>> class C1(object):
-    ...     zope.interface.implements(I1, IContainer)
+    >>> @zope.interface.implementer(I1, IContainer)
+    ... class C1(object):
     ...     def __repr__(self):
     ...         return 'C1'
 
@@ -349,8 +349,8 @@
     >>> class I2(zope.interface.Interface):
     ...     __parent__ = zope.schema.Field(constraint=con1)
     ...
-    >>> class constrainedObject(object):
-    ...     zope.interface.implements(I2)
+    >>> @zope.interface.implementer(I2)
+    ... class constrainedObject(object):
     ...     def __init__(self):
     ...         self.__name__ = 'constrainedObject'
     ...
@@ -364,10 +364,6 @@
 
     """
 
-    adapts(IContained)
-
-    implements(IObjectCopier)
-
     def __init__(self, object):
         self.context = object
         self.__parent__ = object # TODO: see if we can automate this
@@ -416,6 +412,8 @@
         return True
 
 
+ at adapter(IContainer)
+ at implementer(IContainerItemRenamer)
 class ContainerItemRenamer(object):
     """An IContainerItemRenamer adapter for containers.
 
@@ -464,10 +462,6 @@
 
     """
 
-    adapts(IContainer)
-
-    implements(IContainerItemRenamer)
-
     def __init__(self, container):
         self.container = container
 
@@ -486,6 +480,8 @@
         return mover.moveTo(self.container, newName)
 
 
+ at adapter(IOrderedContainer)
+ at implementer(IContainerItemRenamer)
 class OrderedContainerItemRenamer(ContainerItemRenamer):
     """Renames items within an ordered container.
 
@@ -547,10 +543,6 @@
 
     """
 
-    adapts(IOrderedContainer)
-
-    implements(IContainerItemRenamer)
-
     def renameItem(self, oldName, newName):
         order = list(self.container.keys())
         newName = self._renameItem(oldName, newName)
@@ -559,6 +551,8 @@
         return newName
 
 
+ at adapter(IAnnotations)
+ at implementer(IPrincipalClipboard)
 class PrincipalClipboard(object):
     """Principal clipboard
 
@@ -566,10 +560,6 @@
     ``{'action':action, 'target':target}``.
     """
 
-    adapts(IAnnotations)
-
-    implements(IPrincipalClipboard)
-
     def __init__(self, annotation):
         self.context = annotation
 
@@ -594,11 +584,10 @@
         return self.context.get('clipboard', ())
 
 
+ at implementer(INameChooser)
 class ExampleContainer(SampleContainer):
     # Sample container used for examples in doc stringss in this module
 
-    implements(INameChooser)
-
     def chooseName(self, name, ob):
        while name in self:
           name += '_'
@@ -619,8 +608,8 @@
       ...     def __repr__(self):
       ...         return '%s(%s)' % (self.__class__.__name__, self.__name__)
 
-      >>> class C(L):
-      ...     implements(ISublocations)
+      >>> @implementer(ISublocations)
+      ... class C(L):
       ...     def __init__(self, name, *subs):
       ...         L.__init__(self, name)
       ...         self.subs = subs

Modified: zope.copypastemove/trunk/src/zope/copypastemove/interfaces.py
===================================================================
--- zope.copypastemove/trunk/src/zope/copypastemove/interfaces.py	2012-05-18 14:01:12 UTC (rev 126102)
+++ zope.copypastemove/trunk/src/zope/copypastemove/interfaces.py	2012-05-18 14:03:46 UTC (rev 126103)
@@ -15,7 +15,7 @@
 """
 __docformat__ = 'restructuredtext'
 
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 
 class IObjectMover(Interface):
     """Use `IObjectMover(obj)` to move an object somewhere."""
@@ -89,5 +89,6 @@
 class IItemNotFoundError(Interface):
     pass
 
+ at implementer(IItemNotFoundError)
 class ItemNotFoundError(LookupError):
-    implements(IItemNotFoundError)
+    pass

Modified: zope.copypastemove/trunk/src/zope/copypastemove/tests/test_rename.py
===================================================================
--- zope.copypastemove/trunk/src/zope/copypastemove/tests/test_rename.py	2012-05-18 14:01:12 UTC (rev 126102)
+++ zope.copypastemove/trunk/src/zope/copypastemove/tests/test_rename.py	2012-05-18 14:03:46 UTC (rev 126103)
@@ -16,7 +16,7 @@
 import unittest
 
 from doctest import DocTestSuite
-from zope.component import testing, eventtesting, provideAdapter, adapts
+from zope.component import testing, eventtesting, provideAdapter, adapter
 from zope.container.testing import PlacelessSetup, ContainerPlacefulSetup
 from zope.copypastemove import ContainerItemRenamer, ObjectMover
 from zope.copypastemove.interfaces import IContainerItemRenamer
@@ -26,8 +26,8 @@
 class TestContainer(SampleContainer):
     pass
 
+ at adapter(TestContainer)
 class ObstinateNameChooser(NameChooser):
-    adapts(TestContainer)
 
     def chooseName(self, name, ob):
         return u'foobar'
@@ -64,7 +64,7 @@
 
     Also: https://bugs.launchpad.net/zope.copypastemove/+bug/98385
 
-        >>> from zope.component import adapts, provideAdapter
+        >>> from zope.component import adapter, provideAdapter
         >>> from zope.copypastemove import ObjectMover
         >>> provideAdapter(ObjectMover)
 
@@ -85,12 +85,12 @@
 
     with a custom name chooser
 
-        >>> from zope.interface import implements, Interface
+        >>> from zope.interface import implementer, Interface
         >>> from zope.container.interfaces import INameChooser
         >>> class IMyContainer(Interface): pass
-        >>> class MyNameChooser(object):
-        ...     adapts(IMyContainer)
-        ...     implements(INameChooser)
+        >>> @adapter(IMyContainer)
+        ... @implementer(INameChooser)
+        ... class MyNameChooser(object):
         ...     def __init__(self, container):
         ...         self.container = container
         ...     def chooseName(self, name, obj):



More information about the checkins mailing list