Commit eed23e13 authored by Godefroid Chapelle's avatar Godefroid Chapelle

deny attributes being both part of tal:attributes

and having a messageid in i18n:attributes
parent 41b687a5
......@@ -664,6 +664,11 @@ class TALGenerator:
# Convert repldict's name-->expr mapping to a
# name-->(compiled_expr, translate) mapping
for key, value in repldict.items():
if i18nattrs.get(key, None):
raise I18NError(
("attribute [%s] cannot both be part of tal:attributes" +
" and have a msgid in i18n:attributes") % key,
position)
ce = self.compileExpression(value)
repldict[key] = ce, key in i18nattrs, i18nattrs.get(key)
for key in i18nattrs:
......
<input name="Delete"
tal:attributes="name string:delete_button"
i18n:attributes="name">
<input name="Delete"
i18n:attributes="name message-id">
<input i18n:attributes=" name message-id;
attr input-attr ">
<input name="Delete" i18n:attributes="name">
<input name="DELETE_BUTTON">
<input name="MESSAGE-ID">
<input name="MESSAGE-ID" attr="INPUT-ATTR">
......@@ -511,6 +511,9 @@ class TALGeneratorTestCases(TestCaseBase):
('bar', None, 'insert', None, 1, None)])),
('endScope', ()),
])
self._should_error('''<input name="Delete"
tal:attributes="name string:delete_button"
i18n:attributes="name message-id">''')
def test_i18n_name_bad_name(self):
self._should_error("<span i18n:name='not a valid name' />")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment