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
6be0c1d9
Commit
6be0c1d9
authored
Jul 07, 2006
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable docutils file inclusion completely.
parent
9b6892cc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
42 deletions
+8
-42
doc/CHANGES.txt
doc/CHANGES.txt
+5
-0
lib/python/docutils/parsers/rst/directives/misc.py
lib/python/docutils/parsers/rst/directives/misc.py
+3
-42
No files found.
doc/CHANGES.txt
View file @
6be0c1d9
...
...
@@ -40,6 +40,11 @@ Zope Changes
- Collector #2063: cleaned up some mess in MailHost.sendTemplate()
Other Changes
- Disabled docutils file inclusion completely, rather than trying
to jigger it via configuration settings.
Zope 2.8.7 (2007/05/29)
Features added:
...
...
lib/python/docutils/parsers/rst/directives/misc.py
View file @
6be0c1d9
...
...
@@ -24,48 +24,7 @@ except ImportError:
def
include
(
name
,
arguments
,
options
,
content
,
lineno
,
content_offset
,
block_text
,
state
,
state_machine
):
"""Include a reST file as part of the content of this reST file."""
if
not
state
.
document
.
settings
.
file_insertion_enabled
:
warning
=
state_machine
.
reporter
.
warning
(
'"%s" directive disabled.'
%
name
,
nodes
.
literal_block
(
block_text
,
block_text
),
line
=
lineno
)
return
[
warning
]
source
=
state_machine
.
input_lines
.
source
(
lineno
-
state_machine
.
input_offset
-
1
)
source_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
source
))
path
=
directives
.
path
(
arguments
[
0
])
path
=
os
.
path
.
normpath
(
os
.
path
.
join
(
source_dir
,
path
))
path
=
utils
.
relative_path
(
None
,
path
)
encoding
=
options
.
get
(
'encoding'
,
state
.
document
.
settings
.
input_encoding
)
try
:
state
.
document
.
settings
.
record_dependencies
.
add
(
path
)
include_file
=
io
.
FileInput
(
source_path
=
path
,
encoding
=
encoding
,
error_handler
=
state
.
document
.
settings
.
input_encoding_error_handler
,
handle_io_errors
=
None
)
except
IOError
,
error
:
severe
=
state_machine
.
reporter
.
severe
(
'Problems with "%s" directive path:
\
n
%s: %s.'
%
(
name
,
error
.
__class__
.
__name__
,
error
),
nodes
.
literal_block
(
block_text
,
block_text
),
line
=
lineno
)
return
[
severe
]
try
:
include_text
=
include_file
.
read
()
except
UnicodeError
,
error
:
severe
=
state_machine
.
reporter
.
severe
(
'Problem with "%s" directive:
\
n
%s: %s'
%
(
name
,
error
.
__class__
.
__name__
,
error
),
nodes
.
literal_block
(
block_text
,
block_text
),
line
=
lineno
)
return
[
severe
]
if
options
.
has_key
(
'literal'
):
literal_block
=
nodes
.
literal_block
(
include_text
,
include_text
,
source
=
path
)
literal_block
.
line
=
1
return
literal_block
else
:
include_lines
=
statemachine
.
string2lines
(
include_text
,
convert_whitespace
=
1
)
state_machine
.
insert_input
(
include_lines
,
path
)
return
[]
raise
NotImplementedError
,
'File inclusion not allowed!'
include
.
arguments
=
(
1
,
0
,
1
)
include
.
options
=
{
'literal'
:
directives
.
flag
,
...
...
@@ -81,6 +40,8 @@ def raw(name, arguments, options, content, lineno,
Content may be included inline (content section of directive) or
imported from a file or url.
"""
if
options
.
has_key
(
'file'
)
or
options
.
has_key
(
'url'
):
raise
NotImplementedError
,
'File inclusion not allowed!'
print
2
if
(
not
state
.
document
.
settings
.
raw_enabled
or
(
not
state
.
document
.
settings
.
file_insertion_enabled
...
...
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