diff options
author | Marius Gedminas <marius@gedmin.as> | 2013-02-07 23:04:49 +0000 |
---|---|---|
committer | Marius Gedminas <marius@gedmin.as> | 2013-02-07 23:04:49 +0000 |
commit | 40a8c1d0df04e5a970d8c3c4a56540d0f32d4825 (patch) | |
tree | 3de2087d3eed091dbf0ffd07a300ec5711775444 /src/zope | |
parent | 03e77bf187ecbbb53d9e853fcbe16612ef1ca5e0 (diff) | |
download | zope-tal-40a8c1d0df04e5a970d8c3c4a56540d0f32d4825.tar.gz |
Make attribute ordering deterministic
Diffstat (limited to 'src/zope')
-rw-r--r-- | src/zope/tal/talgenerator.py | 6 | ||||
-rw-r--r-- | src/zope/tal/tests/output/test16.xml | 2 | ||||
-rw-r--r-- | src/zope/tal/tests/output/test24.html | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/zope/tal/talgenerator.py b/src/zope/tal/talgenerator.py index 510da64..92a679a 100644 --- a/src/zope/tal/talgenerator.py +++ b/src/zope/tal/talgenerator.py @@ -460,7 +460,7 @@ class TALGenerator(object): 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 @@ class TALGenerator(object): 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 @@ class TALGenerator(object): 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: diff --git a/src/zope/tal/tests/output/test16.xml b/src/zope/tal/tests/output/test16.xml index 77e9069..cb96d01 100644 --- a/src/zope/tal/tests/output/test16.xml +++ b/src/zope/tal/tests/output/test16.xml @@ -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> diff --git a/src/zope/tal/tests/output/test24.html b/src/zope/tal/tests/output/test24.html index 8dbfba3..7f72c59 100644 --- a/src/zope/tal/tests/output/test24.html +++ b/src/zope/tal/tests/output/test24.html @@ -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"> |