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
6e4dc91a
Commit
6e4dc91a
authored
Jul 10, 2006
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests that DTML with fmt="restructured-text" does not expose file inclusion.
parent
f7a9f289
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
lib/python/DocumentTemplate/tests/testDTML.py
lib/python/DocumentTemplate/tests/testDTML.py
+37
-0
No files found.
lib/python/DocumentTemplate/tests/testDTML.py
View file @
6e4dc91a
...
...
@@ -336,6 +336,43 @@ foo bar
spam
=
'<a href="spam">
\
n
foo bar'
)
self
.
assertEqual
(
res
,
expected
)
def
test_fmt_reST_include_directive_raises
(
self
):
source
=
'.. include:: /etc/passwd'
html
=
self
.
doc_class
(
'<dtml-var name="foo" fmt="restructured-text">'
)
html
.
_vars
[
'foo'
]
=
source
self
.
assertRaises
(
NotImplementedError
,
html
)
def
test_fmt_reST_raw_directive_disabled
(
self
):
EXPECTED
=
'<h1>HELLO WORLD</h1>'
source
=
'.. raw:: html
\
n
\
n
%s
\
n
'
%
EXPECTED
html
=
self
.
doc_class
(
'<dtml-var name="foo" fmt="restructured-text">'
)
html
.
_vars
[
'foo'
]
=
source
result
=
html
()
# don't raise, but don't work either
self
.
failIf
(
EXPECTED
in
result
)
self
.
failUnless
(
""raw" directive disabled"
in
result
)
from
cgi
import
escape
self
.
failUnless
(
escape
(
EXPECTED
)
in
result
)
def
test_fmt_reST_raw_directive_file_option_raises
(
self
):
source
=
'.. raw:: html
\
n
:file: inclusion.txt'
html
=
self
.
doc_class
(
'<dtml-var name="foo" fmt="restructured-text">'
)
html
.
_vars
[
'foo'
]
=
source
self
.
assertRaises
(
NotImplementedError
,
html
,
source
)
def
test_fmt_reST_raw_directive_url_option_raises
(
self
):
source
=
'.. raw:: html
\
n
:url: http://www.zope.org'
html
=
self
.
doc_class
(
'<dtml-var name="foo" fmt="restructured-text">'
)
html
.
_vars
[
'foo'
]
=
source
self
.
assertRaises
(
NotImplementedError
,
html
,
source
)
def
testPropogatedError
(
self
):
class
foo
:
...
...
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