Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
2841b113
Commit
2841b113
authored
Jul 25, 2003
by
Chris McDonough
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge TAL i18n fixes which break CMF to HEAD from 2.7 branch.
parent
80a6a792
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
21 deletions
+68
-21
lib/python/TAL/TALGenerator.py
lib/python/TAL/TALGenerator.py
+46
-21
lib/python/TAL/tests/input/test19.html
lib/python/TAL/tests/input/test19.html
+13
-0
lib/python/TAL/tests/output/test19.html
lib/python/TAL/tests/output/test19.html
+9
-0
No files found.
lib/python/TAL/TALGenerator.py
View file @
2841b113
...
...
@@ -657,7 +657,7 @@ class TALGenerator:
else:
repldict = {}
if i18nattrs:
i18nattrs = _parseI18nAttributes(i18nattrs, self.position,
i18nattrs = _parseI18nAttributes(i18nattrs,
attrlist, repldict,
self.position,
self.xml)
else:
i18nattrs = {}
...
...
@@ -796,27 +796,52 @@ class TALGenerator:
self.emitDefineMacro(defineMacro)
def _parseI18nAttributes(i18nattrs, position, xml):
def _parseI18nAttributes(i18nattrs,
attrlist, repldict,
position, xml):
d = {}
for spec in i18nattrs.split("
;
"):
parts = spec.split()
if len(parts) > 2:
raise TALError("
illegal
i18n
:
attributes
specification
:
%
r" % spec,
position)
if len(parts) == 2:
attr, msgid = parts
else:
# len(parts) == 1
attr = parts[0]
msgid = None
if not xml:
attr = attr.lower()
if attr in d:
raise TALError(
"
attribute
may
only
be
specified
once
in
i18n
:
attributes
:
%
r"
% attr,
position)
d[attr] = msgid
if ';' in i18nattrs:
i18nattrlist = i18nattrs.split(';')
i18nattrlist = [attr.strip().split() for attr in i18nattrlist if attr.strip()]
for parts in i18nattrlist:
if len(parts) > 2:
raise TALError("
illegal
i18n
:
attributes
specification
:
%
r" % spec,
position)
if len(parts) == 2:
attr, msgid = parts
else:
# len(parts) == 1
attr = parts[0]
msgid = None
if not xml:
attr = attr.lower()
if attr in d:
raise TALError(
"
attribute
may
only
be
specified
once
in
i18n
:
attributes
:
%
r"
% attr,
position)
d[attr] = msgid
else:
i18nattrlist = i18nattrs.split()
if len(i18nattrlist) == 2:
staticattrs = [attr[0] for attr in attrlist if len(attr) == 2]
if (not i18nattrlist[1] in staticattrs) and (not i18nattrlist[1] in repldict):
attr, msgid = i18nattrlist
d[attr] = msgid
else:
import warnings
warnings.warn('Space separated attributes in i18n:attributes'
+ ' are deprecated (i18n:attributes="
value
title
"). Please use'
+ ' semicolon to separate attributes'
+ ' (i18n:attributes="
value
;
title
").', DeprecationWarning)
for attr in i18nattrlist:
d[attr] = None
else:
import warnings
warnings.warn('Space separated attributes in i18n:attributes'
+ ' are deprecated (i18n:attributes="
value
title
"). Please use'
+ ' semicolon to separate attributes'
+ ' (i18n:attributes="
value
;
title
").', DeprecationWarning)
for attr in i18nattrlist:
d[attr] = None
return d
def test():
...
...
lib/python/TAL/tests/input/test19.html
View file @
2841b113
...
...
@@ -7,3 +7,16 @@
<input
i18n:attributes=
" name message-id;
attr input-attr "
>
<input
name=
"Delete"
i18n:attributes=
"name message-id;"
>
<input
name=
"Delete"
title=
"titletext"
i18n:attributes=
"name title"
>
<input
name=
"Delete"
tal:attributes=
"title string:titletaltext"
i18n:attributes=
"name title"
>
<input
name=
"Delete"
tal:attributes=
"title string:titletaltext"
i18n:attributes=
"name message-id"
>
lib/python/TAL/tests/output/test19.html
View file @
2841b113
...
...
@@ -3,3 +3,12 @@
<input
name=
"MESSAGE-ID"
>
<input
name=
"MESSAGE-ID"
attr=
"INPUT-ATTR"
>
<input
name=
"MESSAGE-ID"
>
<input
name=
"DELETE"
title=
"TITLETEXT"
>
<input
name=
"DELETE"
title=
"TITLETALTEXT"
>
<input
name=
"MESSAGE-ID"
title=
"titletaltext"
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment