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
8ea1fb82
Commit
8ea1fb82
authored
Nov 26, 2004
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge fix for issue #945.
parent
af83b41e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
7 deletions
+17
-7
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/RestrictedPython/RCompile.py
lib/python/RestrictedPython/RCompile.py
+7
-6
lib/python/RestrictedPython/tests/testRestrictions.py
lib/python/RestrictedPython/tests/testRestrictions.py
+7
-1
No files found.
doc/CHANGES.txt
View file @
8ea1fb82
...
...
@@ -46,6 +46,9 @@ Zope Changes
Bugs fixed
- Collector #945: Allow adding empty PythonScript instances
programmatically.
- Updated doc/UNITTEST.txt and lib/python/Testing/README.txt to
reflect progress made since UNITTEST.txt was originally written.
...
...
lib/python/RestrictedPython/RCompile.py
View file @
8ea1fb82
...
...
@@ -220,12 +220,13 @@ class RFunction(RModule):
# Stitch the body code into the function.
f
.
code
.
nodes
=
body_code
.
node
.
nodes
f
.
name
=
self
.
name
# Look for a docstring.
stmt1
=
f
.
code
.
nodes
[
0
]
if
(
isinstance
(
stmt1
,
ast
.
Discard
)
and
isinstance
(
stmt1
.
expr
,
ast
.
Const
)
and
isinstance
(
stmt1
.
expr
.
value
,
str
)):
f
.
doc
=
stmt1
.
expr
.
value
# Look for a docstring, if there are any nodes at all
if
len
(
f
.
code
.
nodes
)
>
0
:
stmt1
=
f
.
code
.
nodes
[
0
]
if
(
isinstance
(
stmt1
,
ast
.
Discard
)
and
isinstance
(
stmt1
.
expr
,
ast
.
Const
)
and
isinstance
(
stmt1
.
expr
.
value
,
str
)):
f
.
doc
=
stmt1
.
expr
.
value
# The caller may specify that certain variables are globals
# so that they can be referenced before a local assignment.
# The only known example is the variables context, container,
...
...
lib/python/RestrictedPython/tests/testRestrictions.py
View file @
8ea1fb82
...
...
@@ -13,7 +13,7 @@ import unittest
from
RestrictedPython
import
compile_restricted
,
PrintCollector
from
RestrictedPython.Eval
import
RestrictionCapableEval
from
RestrictedPython.tests
import
before_and_after
,
restricted_module
,
verify
from
RestrictedPython.RCompile
import
RModule
from
RestrictedPython.RCompile
import
RModule
,
RFunction
try
:
__file__
...
...
@@ -437,6 +437,12 @@ class RestrictionTests(unittest.TestCase):
co
=
self
.
_compile_file
(
"lambda.py"
)
exec
co
in
{},
{}
def
checkEmpty
(
self
):
rf
=
RFunction
(
""
,
""
,
"issue945"
,
"empty.py"
,
{})
rf
.
parse
()
rf2
=
RFunction
(
""
,
"# still empty
\
n
\
n
# by"
,
"issue945"
,
"empty.py"
,
{})
rf2
.
parse
()
def
checkSyntaxError
(
self
):
err
=
(
"def f(x, y):
\
n
"
" if x, y < 2 + 1:
\
n
"
...
...
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