[Checkins] SVN: zope.componentvocabulary/trunk/ Drop support for Python 2.4 and 2.5.
Tres Seaver
cvs-admin at zope.org
Fri May 18 03:50:14 UTC 2012
Log message for revision 126040:
Drop support for Python 2.4 and 2.5.
Replace 'zope.interface.classProvides' usage with equivalent
'zope.interface.provider' decorator.
Replace 'zope.interface.implements' usage with equivalent
'zope.interface.implementer' decorator.
Changed:
U zope.componentvocabulary/trunk/CHANGES.txt
U zope.componentvocabulary/trunk/setup.py
U zope.componentvocabulary/trunk/src/zope/componentvocabulary/vocabulary.py
-=-
Modified: zope.componentvocabulary/trunk/CHANGES.txt
===================================================================
--- zope.componentvocabulary/trunk/CHANGES.txt 2012-05-18 03:44:17 UTC (rev 126039)
+++ zope.componentvocabulary/trunk/CHANGES.txt 2012-05-18 03:50:11 UTC (rev 126040)
@@ -2,9 +2,17 @@
CHANGES
=======
-1.0.2 (unreleased)
+2.0.0 (unreleased)
------------------
+- Replaced deprecated ``zope.interface.classProvides`` usage with equivalent
+ ``zope.interface.provider`` decorator.
+
+- Replaced deprecated ``zope.interface.implements`` usage with equivalent
+ ``zope.interface.implementer`` decorator.
+
+- Dropped support for Python 2.4 and 2.5.
+
- When loading this package's ZCML configuration, make sure to configure
``zope.component`` first since we require part of its configuration.
Modified: zope.componentvocabulary/trunk/setup.py
===================================================================
--- zope.componentvocabulary/trunk/setup.py 2012-05-18 03:44:17 UTC (rev 126039)
+++ zope.componentvocabulary/trunk/setup.py 2012-05-18 03:50:11 UTC (rev 126040)
@@ -22,7 +22,7 @@
setup(name='zope.componentvocabulary',
- version='1.0.2dev',
+ version='2.0.0dev',
author='Zope Foundation and Contributors',
author_email='zope-dev at zope.org',
description='Component vocabularies',
@@ -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.componentvocabulary/trunk/src/zope/componentvocabulary/vocabulary.py
===================================================================
--- zope.componentvocabulary/trunk/src/zope/componentvocabulary/vocabulary.py 2012-05-18 03:44:17 UTC (rev 126039)
+++ zope.componentvocabulary/trunk/src/zope/componentvocabulary/vocabulary.py 2012-05-18 03:50:11 UTC (rev 126040)
@@ -20,7 +20,7 @@
import zope.component
from zope.component.interface import interfaceToName
from zope.component.interfaces import IUtilityRegistration
-from zope.interface import implements, classProvides, Interface, providedBy
+from zope.interface import implementer, provider, Interface, providedBy
from zope.interface.interfaces import IInterface
from zope.security.proxy import removeSecurityProxy
from zope.schema.interfaces import IVocabularyTokenized
@@ -31,6 +31,7 @@
from zope.componentvocabulary.i18n import ZopeMessageFactory as _
+ at implementer(ITokenizedTerm)
class UtilityTerm(object):
"""A term representing a utility.
@@ -52,7 +53,6 @@
>>> term
<UtilityTerm zope.schema.interfaces.IVocabulary, instance of InterfaceClass>
"""
- implements(ITokenizedTerm)
def __init__(self, value, token):
"""Create a term for value and token."""
@@ -64,6 +64,8 @@
self.token, self.value.__class__.__name__)
+ at implementer(IVocabularyTokenized)
+ at provider(IVocabularyFactory)
class UtilityVocabulary(object):
"""Vocabulary that provides utilities of a specified interface.
@@ -74,8 +76,8 @@
>>> class IObject(Interface):
... 'Simple interface to mark object utilities.'
>>>
- >>> class Object(object):
- ... implements(IObject)
+ >>> @implementer(IObject)
+ ... class Object(object):
... def __init__(self, name):
... self.name = name
... def __repr__(self):
@@ -177,8 +179,6 @@
>>> pprint.pprint([term.value for term in vocab])
[u'object1', u'object2', u'object3']
"""
- implements(IVocabularyTokenized)
- classProvides(IVocabularyFactory)
# override these in subclasses
interface = Interface
@@ -231,18 +231,19 @@
return len(self._terms)
+ at provider(IVocabularyFactory)
class InterfacesVocabulary(UtilityVocabulary):
- classProvides(IVocabularyFactory)
interface = IInterface
+ at provider(IVocabularyFactory)
class ObjectInterfacesVocabulary(SimpleVocabulary):
"""A vocabulary that provides a list of all interfaces that its context
provides.
Here a quick demonstration:
- >>> from zope.interface import Interface, implements
+ >>> from zope.interface import Interface, implementer
>>> class I1(Interface):
... pass
>>> class I2(Interface):
@@ -250,8 +251,9 @@
>>> class I3(I2):
... pass
- >>> class Object(object):
- ... implements(I3, I1)
+ >>> @implementer(I3, I1)
+ ... class Object(object):
+ ... pass
>>> vocab = ObjectInterfacesVocabulary(Object())
>>> import pprint
@@ -263,7 +265,6 @@
'zope.componentvocabulary.vocabulary.I3',
'zope.interface.Interface']
"""
- classProvides(IVocabularyFactory)
def __init__(self, context):
# Remove the security proxy so the values from the vocabulary
@@ -275,8 +276,8 @@
super(ObjectInterfacesVocabulary, self).__init__(terms)
+ at provider(IVocabularyFactory)
class UtilityComponentInterfacesVocabulary(ObjectInterfacesVocabulary):
- classProvides(IVocabularyFactory)
def __init__(self, context):
if IUtilityRegistration.providedBy(context):
@@ -285,6 +286,7 @@
context)
+ at implementer(ITitledTokenizedTerm)
class UtilityNameTerm:
r"""Simple term that provides a utility name as a value.
@@ -319,8 +321,6 @@
"""
- implements(ITitledTokenizedTerm)
-
def __init__(self, value):
self.value = unicode(value)
@@ -337,14 +337,16 @@
return self.value or _("(unnamed utility)")
+ at implementer(IVocabularyTokenized)
class UtilityNames:
"""Vocabulary with utility names for a single interface as values.
>>> class IMyUtility(Interface):
... pass
- >>> class MyUtility(object):
- ... implements(IMyUtility)
+ >>> @implementer(IMyUtility)
+ ... class MyUtility(object):
+ ... pass
>>> vocab = UtilityNames(IMyUtility)
@@ -395,7 +397,6 @@
>>> ps.tearDown()
"""
- implements(IVocabularyTokenized)
def __init__(self, interface):
self.interface = interface
More information about the checkins
mailing list