Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
27e4a179
Commit
27e4a179
authored
May 23, 2008
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #1390: Raise ValueError in toxml when an invalid comment would
otherwise be produced.
parent
8c255e41
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
Lib/test/test_minidom.py
Lib/test/test_minidom.py
+5
-0
Lib/xml/dom/minidom.py
Lib/xml/dom/minidom.py
+2
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_minidom.py
View file @
27e4a179
...
@@ -1314,6 +1314,11 @@ class MinidomTest(unittest.TestCase):
...
@@ -1314,6 +1314,11 @@ class MinidomTest(unittest.TestCase):
for
i
in
range
(
len
(
n1
.
childNodes
)):
for
i
in
range
(
len
(
n1
.
childNodes
)):
stack
.
append
((
n1
.
childNodes
[
i
],
n2
.
childNodes
[
i
]))
stack
.
append
((
n1
.
childNodes
[
i
],
n2
.
childNodes
[
i
]))
def
testSerializeCommentNodeWithDoubleHyphen
(
self
):
doc
=
create_doc_without_doctype
()
doc
.
appendChild
(
doc
.
createComment
(
"foo--bar"
))
self
.
assertRaises
(
ValueError
,
doc
.
toxml
)
def
test_main
():
def
test_main
():
run_unittest
(
MinidomTest
)
run_unittest
(
MinidomTest
)
...
...
Lib/xml/dom/minidom.py
View file @
27e4a179
...
@@ -1128,6 +1128,8 @@ class Comment(Childless, CharacterData):
...
@@ -1128,6 +1128,8 @@ class Comment(Childless, CharacterData):
self
.
data
=
self
.
nodeValue
=
data
self
.
data
=
self
.
nodeValue
=
data
def
writexml
(
self
,
writer
,
indent
=
""
,
addindent
=
""
,
newl
=
""
):
def
writexml
(
self
,
writer
,
indent
=
""
,
addindent
=
""
,
newl
=
""
):
if
"--"
in
self
.
data
:
raise
ValueError
(
"'--' is not allowed in a comment node"
)
writer
.
write
(
"%s<!--%s-->%s"
%
(
indent
,
self
.
data
,
newl
))
writer
.
write
(
"%s<!--%s-->%s"
%
(
indent
,
self
.
data
,
newl
))
...
...
Misc/NEWS
View file @
27e4a179
...
@@ -59,6 +59,9 @@ Extension Modules
...
@@ -59,6 +59,9 @@ Extension Modules
Library
Library
-------
-------
- Issue #1390: Raise ValueError in toxml when an invalid comment would
otherwise be produced.
- Issue #2914: TimedRotatingFileHandler now takes an optional keyword
- Issue #2914: TimedRotatingFileHandler now takes an optional keyword
argument "utc" to use UTC time rather than local time.
argument "utc" to use UTC time rather than local time.
...
...
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