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
746441c4
Commit
746441c4
authored
Aug 18, 2003
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- wrap some long lines
- move shared text for warnings so it isn't repeated
parent
7eeb7603
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
22 deletions
+24
-22
lib/python/TAL/TALGenerator.py
lib/python/TAL/TALGenerator.py
+24
-22
No files found.
lib/python/TAL/TALGenerator.py
View file @
746441c4
...
...
@@ -669,8 +669,8 @@ class TALGenerator:
else:
repldict = {}
if i18nattrs:
i18nattrs = _parseI18nAttributes(i18nattrs, attrlist, repldict,
self.position,
self.xml)
i18nattrs = _parseI18nAttributes(i18nattrs, attrlist, repldict,
self.
position, self.
xml)
else:
i18nattrs = {}
# Convert repldict's name-->expr mapping to a
...
...
@@ -678,7 +678,7 @@ class TALGenerator:
for key, value in repldict.items():
if i18nattrs.get(key, None):
raise I18NError(
("
attribute
[
%
s
]
cannot
both
be
part
of
tal
:
attributes
" +
("
attribute
[
%
s
]
cannot
both
be
part
of
tal
:
attributes
"
"
and
have
a
msgid
in
i18n
:
attributes
") % key,
position)
ce = self.compileExpression(value)
...
...
@@ -821,10 +821,12 @@ def _parseI18nAttributes(i18nattrs, attrlist, repldict, position, xml):
d = {}
if ';' in i18nattrs:
i18nattrlist = i18nattrs.split(';')
i18nattrlist = [attr.strip().split() for attr in i18nattrlist if attr.strip()]
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,
raise TALError(
"
illegal
i18n
:
attributes
specification
:
%
r" % spec,
position)
if len(parts) == 2:
attr, msgid = parts
...
...
@@ -836,35 +838,35 @@ def _parseI18nAttributes(i18nattrs, attrlist, repldict, position, xml):
attr = attr.lower()
if attr in d:
raise TALError(
"
attribute
may
only
be
specified
once
in
i18n
:
attributes
:
%
r
"
% attr
,
"
attribute
may
only
be
specified
once
in
i18n
:
attributes
:
"
+ `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):
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)
warnings.warn(I18N_ATTRIBUTES_WARNING, 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)
warnings.warn(I18N_ATTRIBUTES_WARNING, DeprecationWarning)
for attr in i18nattrlist:
d[attr] = None
return d
I18N_ATTRIBUTES_WARNING = (
'Space separated attributes in i18n:attributes are deprecated'
' (i18n:attributes="
value
title
"). Please use a semicolon to'
' separate attributes (i18n:attributes="
value
;
title
").')
def test():
t = TALGenerator()
t.pushProgram()
...
...
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