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

Tres Seaver cvs-admin at zope.org
Thu May 17 20:31:09 UTC 2012


Log message for revision 125968:
  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.annotation/trunk/CHANGES.txt
  U   zope.annotation/trunk/setup.py
  U   zope.annotation/trunk/src/zope/annotation/README.txt
  U   zope.annotation/trunk/src/zope/annotation/attribute.py
  U   zope.annotation/trunk/src/zope/annotation/tests/annotations.py
  U   zope.annotation/trunk/src/zope/annotation/tests/test_attributeannotations.py

-=-
Modified: zope.annotation/trunk/CHANGES.txt
===================================================================
--- zope.annotation/trunk/CHANGES.txt	2012-05-17 20:28:40 UTC (rev 125967)
+++ zope.annotation/trunk/CHANGES.txt	2012-05-17 20:31:06 UTC (rev 125968)
@@ -5,6 +5,14 @@
 3.6.0 (unreleased)
 ------------------
 
+- Replace deprecated ``zope.component.adapts`` usage with equivalent
+  ``zope.component.adapter`` decorator.
+
+- Replace deprecated ``zope.interface.implements`` usage with equivalent
+  ``zope.interface.implementer`` decorator.
+
+- Drop 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.annotation/trunk/setup.py
===================================================================
--- zope.annotation/trunk/setup.py	2012-05-17 20:28:40 UTC (rev 125967)
+++ zope.annotation/trunk/setup.py	2012-05-17 20:31:06 UTC (rev 125968)
@@ -38,6 +38,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",
         'Natural Language :: English',
         'Operating System :: OS Independent',
         'Topic :: Internet :: WWW/HTTP',

Modified: zope.annotation/trunk/src/zope/annotation/README.txt
===================================================================
--- zope.annotation/trunk/src/zope/annotation/README.txt	2012-05-17 20:28:40 UTC (rev 125967)
+++ zope.annotation/trunk/src/zope/annotation/README.txt	2012-05-17 20:31:06 UTC (rev 125968)
@@ -20,8 +20,9 @@
   ...     pass
   >>> from zope.annotation.interfaces import IAttributeAnnotatable
   >>> from persistent import Persistent
-  >>> class Foo(Persistent):
-  ...     interface.implements(IFoo, IAttributeAnnotatable)
+  >>> @interface.implementer(IFoo, IAttributeAnnotatable)
+  ... class Foo(Persistent):
+  ...     pass
 
 We directly say that Foo implements IAttributeAnnotatable here. In
 practice this is often done in ZCML, using the `implements`
@@ -33,8 +34,8 @@
   ...     a = interface.Attribute('A')
   ...     b = interface.Attribute('B')
   >>> from zope import component
-  >>> class Bar(Persistent):
-  ...     interface.implements(IBar)
+  >>> @interface.implementer(IBar)
+  ... class Bar(Persistent):
   ...     component.adapts(IFoo)
   ...     def __init__(self):
   ...         self.a = 1
@@ -79,8 +80,9 @@
 
   >>> class IQux(interface.Interface):
   ...     pass
-  >>> class Qux(Persistent):
-  ...     interface.implements(IQux)
+  >>> @interface.implementer(IQux)
+  ... class Qux(Persistent):
+  ...     pass
   >>> component.provideAdapter(factory(Qux)) # doctest: +ELLIPSIS
   Traceback (most recent call last):
   ...
@@ -92,8 +94,8 @@
 
   >>> class IHoi(interface.Interface):
   ...     pass
-  >>> class Hoi(Persistent):
-  ...     interface.implements(IHoi)
+  >>> @interface.implementer(IHoi)
+  ... class Hoi(Persistent):
   ...     component.adapts(IFoo)
   >>> component.provideAdapter(factory(Hoi, 'my.unique.key'))
   >>> isinstance(IHoi(foo), Hoi)
@@ -140,8 +142,8 @@
 
   >>> class IPolloi(interface.Interface):
   ...     pass
-  >>> class Polloi(Persistent):
-  ...     interface.implements(IPolloi, zope.location.interfaces.ILocation)
+  >>> @interface.implementer(IPolloi, zope.location.interfaces.ILocation)
+  ... class Polloi(Persistent):
   ...     component.adapts(IFoo)
   ...     __name__ = __parent__ = 0
   >>> component.provideAdapter(factory(Polloi, 'my.other.key'))

Modified: zope.annotation/trunk/src/zope/annotation/attribute.py
===================================================================
--- zope.annotation/trunk/src/zope/annotation/attribute.py	2012-05-17 20:28:40 UTC (rev 125967)
+++ zope.annotation/trunk/src/zope/annotation/attribute.py	2012-05-17 20:31:06 UTC (rev 125968)
@@ -21,14 +21,14 @@
 from zope import component, interface
 from zope.annotation import interfaces
 
+ at interface.implementer(interfaces.IAnnotations)
+ at component.adapter(interfaces.IAttributeAnnotatable)
 class AttributeAnnotations(DictMixin):
     """Store annotations on an object
 
     Store annotations in the `__annotations__` attribute on a
     `IAttributeAnnotatable` object.
     """
-    interface.implements(interfaces.IAnnotations)
-    component.adapts(interfaces.IAttributeAnnotatable)
 
     def __init__(self, obj, context=None):
         self.obj = obj

Modified: zope.annotation/trunk/src/zope/annotation/tests/annotations.py
===================================================================
--- zope.annotation/trunk/src/zope/annotation/tests/annotations.py	2012-05-17 20:28:40 UTC (rev 125967)
+++ zope.annotation/trunk/src/zope/annotation/tests/annotations.py	2012-05-17 20:31:06 UTC (rev 125968)
@@ -31,11 +31,11 @@
         self.obj = {1:2, 3:4}
 
     def test_nonzero(self):
-        self.failIf(self.annotations)
+        self.assertFalse(self.annotations)
         self.annotations['unittest'] = self.obj
-        self.failUnless(self.annotations)
+        self.assertTrue(self.annotations)
         del self.annotations['unittest']
-        self.failIf(self.annotations)        
+        self.assertFalse(self.annotations)        
 
     def testInterfaceVerifies(self):
         verifyObject(IAnnotations, self.annotations)
@@ -44,7 +44,7 @@
         # test __getitem__
         self.annotations['unittest'] = self.obj
         res = self.annotations['unittest']
-        self.failUnlessEqual(self.obj, res)
+        self.assertEqual(self.obj, res)
 
     def testGetitemException(self):
         # test __getitem__ raises exception on unknown key
@@ -54,22 +54,22 @@
         # test get
         self.annotations['unittest'] = self.obj
         res = self.annotations.get('unittest')
-        self.failUnlessEqual(self.obj, res)
+        self.assertEqual(self.obj, res)
 
     def testGetNoSet(self):
         # test get with no set
         res = self.annotations.get('randomkey')
-        self.failUnlessEqual(None, res)
+        self.assertEqual(None, res)
 
     def testGetDefault(self):
         # test get returns default
         res = self.annotations.get('randomkey', 'default')
-        self.failUnlessEqual('default', res)
+        self.assertEqual('default', res)
 
     def testDel(self):
         self.annotations['unittest'] = self.obj
         del self.annotations['unittest']
-        self.failUnlessEqual(None, self.annotations.get('unittest'))
+        self.assertEqual(None, self.annotations.get('unittest'))
 
     def testDelRaisesKeyError(self):
         self.assertRaises(KeyError, self.annotations.__delitem__, 'unittest')

Modified: zope.annotation/trunk/src/zope/annotation/tests/test_attributeannotations.py
===================================================================
--- zope.annotation/trunk/src/zope/annotation/tests/test_attributeannotations.py	2012-05-17 20:28:40 UTC (rev 125967)
+++ zope.annotation/trunk/src/zope/annotation/tests/test_attributeannotations.py	2012-05-17 20:31:06 UTC (rev 125968)
@@ -16,14 +16,15 @@
 """
 import unittest, doctest
 from zope.testing import cleanup
-from zope.interface import implements
+from zope.interface import implementer
 from zope import component
 from zope.annotation.tests.annotations import AnnotationsTest
 from zope.annotation.attribute import AttributeAnnotations
 from zope.annotation.interfaces import IAttributeAnnotatable
 
+ at implementer(IAttributeAnnotatable)
 class Dummy(object):
-    implements(IAttributeAnnotatable)
+    pass
 
 class AttributeAnnotationsTest(AnnotationsTest, cleanup.CleanUp):
 



More information about the checkins mailing list