[Checkins] SVN: zope.tal/trunk/src/zope/tal/t Make attribute ordering deterministic

Marius Gedminas cvs-admin at zope.org
Thu Feb 7 23:04:49 UTC 2013


Log message for revision 129192:
  Make attribute ordering deterministic

Changed:
  U   zope.tal/trunk/src/zope/tal/talgenerator.py
  U   zope.tal/trunk/src/zope/tal/tests/output/test16.xml
  U   zope.tal/trunk/src/zope/tal/tests/output/test24.html

-=-
Modified: zope.tal/trunk/src/zope/tal/talgenerator.py
===================================================================
--- zope.tal/trunk/src/zope/tal/talgenerator.py	2013-02-07 23:04:46 UTC (rev 129191)
+++ zope.tal/trunk/src/zope/tal/talgenerator.py	2013-02-07 23:04:49 UTC (rev 129192)
@@ -460,7 +460,7 @@
                 del repldict[key]
             newlist.append(item)
         # Add dynamic-only attributes
-        for key, (expr, xlat, msgid) in repldict.items():
+        for key, (expr, xlat, msgid) in sorted(repldict.items()):
             newlist.append((key, None, "insert", expr, xlat, msgid))
         return newlist
 
@@ -686,7 +686,7 @@
                 i18nattrs = {}
             # Convert repldict's name-->expr mapping to a
             # name-->(compiled_expr, translate) mapping
-            for key, value in repldict.items():
+            for key, value in sorted(repldict.items()):
                 if i18nattrs.get(key, None):
                     raise I18NError(
                         "attribute [%s] cannot both be part of tal:attributes"
@@ -694,7 +694,7 @@
                         position)
                 ce = self.compileExpression(value)
                 repldict[key] = ce, key in i18nattrs, i18nattrs.get(key)
-            for key in i18nattrs:
+            for key in sorted(i18nattrs):
                 if key not in repldict:
                     repldict[key] = None, 1, i18nattrs.get(key)
         else:

Modified: zope.tal/trunk/src/zope/tal/tests/output/test16.xml
===================================================================
--- zope.tal/trunk/src/zope/tal/tests/output/test16.xml	2013-02-07 23:04:46 UTC (rev 129191)
+++ zope.tal/trunk/src/zope/tal/tests/output/test16.xml	2013-02-07 23:04:49 UTC (rev 129192)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <body>
 
-<ImG href="foo" Alt="bar" alT="baz" Href="about:foo"/>
+<ImG href="foo" Alt="bar" Href="about:foo" alT="baz"/>
 
 </body>

Modified: zope.tal/trunk/src/zope/tal/tests/output/test24.html
===================================================================
--- zope.tal/trunk/src/zope/tal/tests/output/test24.html	2013-02-07 23:04:46 UTC (rev 129191)
+++ zope.tal/trunk/src/zope/tal/tests/output/test24.html	2013-02-07 23:04:49 UTC (rev 129192)
@@ -2,6 +2,6 @@
 
 <input name="MESSAGE-ID">
 
-<input name="MESSAGE-ID" attr="INPUT-ATTR">
+<input attr="INPUT-ATTR" name="MESSAGE-ID">
 
-<input name="MESSAGE-ID" attr="INPUT-ATTR">
+<input attr="INPUT-ATTR" name="MESSAGE-ID">



More information about the checkins mailing list