[Checkins] SVN: zope.documenttemplate/trunk/ - Fixed usage of 'with' as a variable name. It is now a keyword in

Sidnei da Silva sidnei at enfoldsystems.com
Wed Oct 8 01:02:37 EDT 2008


Log message for revision 91893:
  - Fixed usage of 'with' as a variable name. It is now a keyword in
    Python 2.6, causing a SyntaxError. ``zope.documenttemplate`` now
    supports Python 2.6.
  
  

Changed:
  U   zope.documenttemplate/trunk/CHANGES.txt
  U   zope.documenttemplate/trunk/src/zope/documenttemplate/pdocumenttemplate.py

-=-
Modified: zope.documenttemplate/trunk/CHANGES.txt
===================================================================
--- zope.documenttemplate/trunk/CHANGES.txt	2008-10-08 04:29:33 UTC (rev 91892)
+++ zope.documenttemplate/trunk/CHANGES.txt	2008-10-08 05:02:37 UTC (rev 91893)
@@ -2,6 +2,13 @@
 CHANGES
 =======
 
+3.4.1 (Unreleased)
+------------------
+
+- Fixed usage of 'with' as a variable name. It is now a keyword in
+  Python 2.6, causing a SyntaxError. ``zope.documenttemplate`` now
+  supports Python 2.6.
+
 3.4.0 (2007/10/02)
 ------------------
 

Modified: zope.documenttemplate/trunk/src/zope/documenttemplate/pdocumenttemplate.py
===================================================================
--- zope.documenttemplate/trunk/src/zope/documenttemplate/pdocumenttemplate.py	2008-10-08 04:29:33 UTC (rev 91892)
+++ zope.documenttemplate/trunk/src/zope/documenttemplate/pdocumenttemplate.py	2008-10-08 05:02:37 UTC (rev 91893)
@@ -228,9 +228,11 @@
                 v = v()
         return v
 
-    def reorder(self, s, with=None, without=()):
-        if with is None:
-            with = s
+    def reorder(self, s, with_=None, without=(), **kw):
+        if with_ is None and kw.has_key('with'):
+            with_ = kw['with']
+        if with_ is None:
+            with_ = s
         d = {}
         for i in s:
             if isinstance(i, TupleType) and len(i) == 2:
@@ -250,11 +252,11 @@
             if h(k):
                 del d[k]
 
-        for i in with:
+        for i in with_:
             if isinstance(i, TupleType) and len(i) == 2:
                 k, v = i
             else:
-                k= v = i
+                k = v = i
             if h(k):
                 a((k,d[k]))
                 del d[k]



More information about the Checkins mailing list