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
c717ab10
Commit
c717ab10
authored
Aug 03, 2006
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix yet another resTructuredText glitch, and add tests (test backported from
2.9, which was not in fact vulnerable).
parent
4724c08d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
1 deletion
+45
-1
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/Products/ZReST/tests/test_ZReST.py
lib/python/Products/ZReST/tests/test_ZReST.py
+29
-0
lib/python/reStructuredText/__init__.py
lib/python/reStructuredText/__init__.py
+1
-1
lib/python/reStructuredText/tests/testReST.py
lib/python/reStructuredText/tests/testReST.py
+12
-0
No files found.
doc/CHANGES.txt
View file @
c717ab10
...
@@ -8,6 +8,9 @@ Zope Changes
...
@@ -8,6 +8,9 @@ Zope Changes
Bugs fixed
Bugs fixed
- Fix yet another resTructuredText glitch, and add tests (test
backported from 2.9, which was not in fact vulnerable).
- Collector #2157: Expose name of broken class in SystemError raised
- Collector #2157: Expose name of broken class in SystemError raised
from '__getstate__' of a broken instance.
from '__getstate__' of a broken instance.
...
...
lib/python/Products/ZReST/tests/test_ZReST.py
View file @
c717ab10
...
@@ -3,6 +3,12 @@
...
@@ -3,6 +3,12 @@
$Id$
$Id$
"""
"""
import
unittest
import
unittest
import
tempfile
csv_text
=
"""bin:x:1:1:bin:/bin:/bin/bash
daemon:x:2:2:Daemon:/sbin:/bin/bash
"""
class
TestZReST
(
unittest
.
TestCase
):
class
TestZReST
(
unittest
.
TestCase
):
...
@@ -13,6 +19,11 @@ class TestZReST(unittest.TestCase):
...
@@ -13,6 +19,11 @@ class TestZReST(unittest.TestCase):
def
_makeOne
(
self
,
id
=
'test'
,
*
args
,
**
kw
):
def
_makeOne
(
self
,
id
=
'test'
,
*
args
,
**
kw
):
return
self
.
_getTargetClass
()(
id
=
id
,
*
args
,
**
kw
)
return
self
.
_getTargetClass
()(
id
=
id
,
*
args
,
**
kw
)
def
_csvfile
(
self
):
fn
=
tempfile
.
mktemp
()
open
(
fn
,
'w'
).
write
(
csv_text
)
return
fn
def
test_empty
(
self
):
def
test_empty
(
self
):
empty
=
self
.
_makeOne
()
empty
=
self
.
_makeOne
()
...
@@ -59,6 +70,24 @@ class TestZReST(unittest.TestCase):
...
@@ -59,6 +70,24 @@ class TestZReST(unittest.TestCase):
resty
.
source
=
'.. raw:: html
\
n
:url: http://www.zope.org/'
resty
.
source
=
'.. raw:: html
\
n
:url: http://www.zope.org/'
self
.
assertRaises
(
NotImplementedError
,
resty
.
render
)
self
.
assertRaises
(
NotImplementedError
,
resty
.
render
)
def
test_csv_table_file_option_raise
(
self
):
resty
=
self
.
_makeOne
()
csv_file
=
self
.
_csvfile
()
resty
.
source
=
'.. csv-table::
\
n
:file: %s'
%
csv_file
result
=
resty
.
render
()
self
.
failUnless
(
'daemon'
not
in
result
,
'csv-table/file directive is not disabled!'
)
def
test_csv_table_url_option_raise
(
self
):
resty
=
self
.
_makeOne
()
csv_file
=
self
.
_csvfile
()
resty
.
source
=
'.. csv-table::
\
n
:url: file://%s'
%
csv_file
result
=
resty
.
render
()
self
.
failUnless
(
'daemon'
not
in
result
,
'csv-table/url directive is not disabled!'
)
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestZReST
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZReST
))
...
...
lib/python/reStructuredText/__init__.py
View file @
c717ab10
...
@@ -74,7 +74,7 @@ def render(src,
...
@@ -74,7 +74,7 @@ def render(src,
if
language_code
:
if
language_code
:
settings
[
'language_code'
]
=
language_code
settings
[
'language_code'
]
=
language_code
settings
[
'language_code'
]
=
language_code
settings
[
'language_code'
]
=
language_code
settings
[
'file_insertion_enabled
'
]
=
0
settings
[
'file_insertion_enabled'
]
=
0
settings
[
'raw_enabled'
]
=
0
settings
[
'raw_enabled'
]
=
0
# starting level for <H> elements:
# starting level for <H> elements:
settings
[
'initial_header_level'
]
=
initial_header_level
+
1
settings
[
'initial_header_level'
]
=
initial_header_level
+
1
...
...
lib/python/reStructuredText/tests/testReST.py
View file @
c717ab10
...
@@ -48,6 +48,18 @@ text
...
@@ -48,6 +48,18 @@ text
source
=
'.. raw:: html
\
n
:url: http://www.zope.org'
source
=
'.. raw:: html
\
n
:url: http://www.zope.org'
self
.
assertRaises
(
NotImplementedError
,
HTML
,
source
)
self
.
assertRaises
(
NotImplementedError
,
HTML
,
source
)
def
test_csv_table_file_option_raise
(
self
):
source
=
'.. csv-table::
\
n
:file: inclusion.txt'
result
=
HTML
(
source
)
self
.
failUnless
(
'directive disabled'
in
result
)
def
test_csv_table_url_option_raise
(
self
):
source
=
'.. csv-table::
\
n
:url: http://www.evil.org'
result
=
HTML
(
source
)
self
.
failUnless
(
'directive disabled'
in
result
)
def
test_suite
():
def
test_suite
():
from
unittest
import
TestSuite
,
makeSuite
from
unittest
import
TestSuite
,
makeSuite
return
TestSuite
((
makeSuite
(
TestReST
),))
return
TestSuite
((
makeSuite
(
TestReST
),))
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