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
dec5501d
Commit
dec5501d
authored
Apr 25, 2003
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise TALError when tal:content is used on an HTML tag that must be empty.
parent
36edcfae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
lib/python/TAL/HTMLTALParser.py
lib/python/TAL/HTMLTALParser.py
+8
-0
lib/python/TAL/tests/test_htmltalparser.py
lib/python/TAL/tests/test_htmltalparser.py
+2
-0
No files found.
lib/python/TAL/HTMLTALParser.py
View file @
dec5501d
...
...
@@ -142,6 +142,10 @@ class HTMLTALParser(HTMLParser):
self
.
scan_xmlns
(
attrs
)
tag
,
attrlist
,
taldict
,
metaldict
,
i18ndict
\
=
self
.
process_ns
(
tag
,
attrs
)
if
tag
in
EMPTY_HTML_TAGS
and
taldict
.
get
(
"content"
):
raise
TALError
(
"empty HTML tags cannot use tal:content: %s"
%
`tag`
,
self
.
getpos
())
self
.
tagstack
.
append
(
tag
)
self
.
gen
.
emitStartElement
(
tag
,
attrlist
,
taldict
,
metaldict
,
i18ndict
,
self
.
getpos
())
...
...
@@ -154,6 +158,10 @@ class HTMLTALParser(HTMLParser):
tag
,
attrlist
,
taldict
,
metaldict
,
i18ndict
\
=
self
.
process_ns
(
tag
,
attrs
)
if
taldict
.
get
(
"content"
):
if
tag
in
EMPTY_HTML_TAGS
:
raise
TALError
(
"empty HTML tags cannot use tal:content: %s"
%
`tag`
,
self
.
getpos
())
self
.
gen
.
emitStartElement
(
tag
,
attrlist
,
taldict
,
metaldict
,
i18ndict
,
self
.
getpos
())
self
.
gen
.
emitEndElement
(
tag
,
implied
=-
1
)
...
...
lib/python/TAL/tests/test_htmltalparser.py
View file @
dec5501d
...
...
@@ -478,6 +478,8 @@ class TALGeneratorTestCases(TestCaseBase):
self
.
_should_error
(
"<p tal:foobar='x' />"
)
self
.
_should_error
(
"<p tal:replace='x' tal:content='x' />"
)
self
.
_should_error
(
"<p tal:replace='x'>"
)
for
tag
in
HTMLTALParser
.
EMPTY_HTML_TAGS
:
self
.
_should_error
(
"<%s tal:content='string:foo'>"
%
tag
)
def
check_metal_errors
(
self
):
exc
=
METALError
...
...
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