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

Tres Seaver cvs-admin at zope.org
Thu May 17 23:16:48 UTC 2012


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

Changed:
  U   zope.tales/trunk/CHANGES.txt
  U   zope.tales/trunk/setup.py
  U   zope.tales/trunk/src/zope/tales/expressions.py
  U   zope.tales/trunk/src/zope/tales/tales.py
  U   zope.tales/trunk/src/zope/tales/tests/test_expressions.py

-=-
Modified: zope.tales/trunk/CHANGES.txt
===================================================================
--- zope.tales/trunk/CHANGES.txt	2012-05-17 23:07:26 UTC (rev 126014)
+++ zope.tales/trunk/CHANGES.txt	2012-05-17 23:16:45 UTC (rev 126015)
@@ -1,9 +1,14 @@
 CHANGES
 =======
 
-3.5.2 (unreleased)
+4.0.0 (unreleased)
 ------------------
 
+- Replaced deprecated ``zope.interface.implements`` usage with equivalent
+  ``zope.interface.implementer`` decorator.
+
+- Dropped support for Python 2.4 and 2.5.
+
 - Fixed documentation link in README.txt
 
 3.5.1 (2010-04-30)

Modified: zope.tales/trunk/setup.py
===================================================================
--- zope.tales/trunk/setup.py	2012-05-17 23:07:26 UTC (rev 126014)
+++ zope.tales/trunk/setup.py	2012-05-17 23:16:45 UTC (rev 126015)
@@ -25,7 +25,7 @@
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
 
 setup(name='zope.tales',
-      version = '3.5.2dev',
+      version = '4.0.0dev',
       author='Zope Foundation and Contributors',
       author_email='zope-dev at zope.org',
       description='Zope Template Application Language Expression Syntax '
@@ -42,6 +42,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.tales/trunk/src/zope/tales/expressions.py
===================================================================
--- zope.tales/trunk/src/zope/tales/expressions.py	2012-05-17 23:07:26 UTC (rev 126014)
+++ zope.tales/trunk/src/zope/tales/expressions.py	2012-05-17 23:16:45 UTC (rev 126015)
@@ -15,7 +15,7 @@
 """
 import re, types
 
-from zope.interface import implements
+from zope.interface import implementer
 from zope.tales.tales import _valid_name, _parse_expr, NAME_RE, Undefined
 from zope.tales.interfaces import ITALESExpression, ITALESFunctionNamespace
 
@@ -137,9 +137,9 @@
         return ob
 
 
+ at implementer(ITALESExpression)
 class PathExpr(object):
     """One or more subpath expressions, separated by '|'."""
-    implements(ITALESExpression)
 
     # _default_type_names contains the expression type names this
     # class is usually registered for.
@@ -224,8 +224,8 @@
 
 _interp = re.compile(r'\$(%(n)s)|\${(%(n)s(?:/[^}]*)*)}' % {'n': NAME_RE})
 
+ at implementer(ITALESExpression)
 class StringExpr(object):
-    implements(ITALESExpression)
 
     def __init__(self, name, expr, engine):
         self._s = expr
@@ -267,8 +267,8 @@
         return '<StringExpr %s>' % `self._s`
 
 
+ at implementer(ITALESExpression)
 class NotExpr(object):
-    implements(ITALESExpression)
 
     def __init__(self, name, expr, engine):
         self._s = expr = expr.lstrip()
@@ -293,8 +293,8 @@
         return self._expr(self._econtext)
 
 
+ at implementer(ITALESExpression)
 class DeferExpr(object):
-    implements(ITALESExpression)
 
     def __init__(self, name, expr, compiler):
         self._s = expr = expr.lstrip()

Modified: zope.tales/trunk/src/zope/tales/tales.py
===================================================================
--- zope.tales/trunk/src/zope/tales/tales.py	2012-05-17 23:07:26 UTC (rev 126014)
+++ zope.tales/trunk/src/zope/tales/tales.py	2012-05-17 23:16:45 UTC (rev 126015)
@@ -18,19 +18,22 @@
 __docformat__ = "reStructuredText"
 import re
 
-from zope.interface import implements
+from zope.interface import implementer
 
 try:
-    from zope import tal
-except ImportError:
-    tal = None
-
-if tal:
     from zope.tal.interfaces import ITALExpressionEngine
     from zope.tal.interfaces import ITALExpressionCompiler
     from zope.tal.interfaces import ITALExpressionErrorInfo
-    from zope.tales.interfaces import ITALESIterator
+except ImportError:
+    from zope.interface import Interface
+    class ITALExpressionEngine(Interface):
+        pass
+    class ITALExpressionCompiler(Interface):
+        pass
+    class ITALExpressionErrorInfo(Interface):
+        pass
 
+from zope.tales.interfaces import ITALESIterator
 
 NAME_RE = r"[a-zA-Z][a-zA-Z0-9_]*"
 _parse_expr = re.compile(r"(%s):" % NAME_RE).match
@@ -52,13 +55,11 @@
 
 _default = object()
 
+ at implementer(ITALESIterator)
 class Iterator(object):
     """TALES Iterator
     """
 
-    if tal:
-        implements(ITALESIterator)
-
     def __init__(self, name, seq, context):
         """Construct an iterator
 
@@ -485,10 +486,9 @@
         return len(self._seq)
 
 
+ at implementer(ITALExpressionErrorInfo)
 class ErrorInfo(object):
     """Information about an exception passed to an on-error handler."""
-    if tal:
-        implements(ITALExpressionErrorInfo)
 
     def __init__(self, err, position=(None, None)):
         if isinstance(err, Exception):
@@ -501,6 +501,7 @@
         self.offset = position[1]
 
 
+ at implementer(ITALExpressionCompiler)
 class ExpressionEngine(object):
     '''Expression Engine
 
@@ -509,8 +510,6 @@
     these handlers.  It can provide an expression Context, which is
     capable of holding state and evaluating compiled expressions.
     '''
-    if tal:
-        implements(ITALExpressionCompiler)
 
     def __init__(self):
         self.types = {}
@@ -607,16 +606,13 @@
         return CompilerError
 
 
+ at implementer(ITALExpressionEngine)
 class Context(object):
     '''Expression Context
 
     An instance of this class holds context information that it can
     use to evaluate compiled expressions.
     '''
-
-    if tal:
-        implements(ITALExpressionEngine)
-
     position = (None, None)
     source_file = None
 

Modified: zope.tales/trunk/src/zope/tales/tests/test_expressions.py
===================================================================
--- zope.tales/trunk/src/zope/tales/tests/test_expressions.py	2012-05-17 23:07:26 UTC (rev 126014)
+++ zope.tales/trunk/src/zope/tales/tests/test_expressions.py	2012-05-17 23:16:45 UTC (rev 126015)
@@ -19,7 +19,7 @@
 from zope.tales.engine import Engine
 from zope.tales.interfaces import ITALESFunctionNamespace
 from zope.tales.tales import Undefined
-from zope.interface import implements
+from zope.interface import implementer
 
 class Data(object):
 
@@ -246,8 +246,8 @@
         ExpressionTestBase.setUp(self)
 
         # a test namespace
+        @implementer(ITALESFunctionNamespace)
         class TestNameSpace(object):
-            implements(ITALESFunctionNamespace)
 
             def __init__(self, context):
                 self.context = context



More information about the checkins mailing list