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
5aeb67d3
Commit
5aeb67d3
authored
Jan 16, 2004
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Merge fix / test for Collector #1186
parent
f8899497
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
3 deletions
+33
-3
lib/python/AccessControl/ZopeGuards.py
lib/python/AccessControl/ZopeGuards.py
+4
-1
lib/python/AccessControl/tests/testSecurity.py
lib/python/AccessControl/tests/testSecurity.py
+29
-2
No files found.
lib/python/AccessControl/ZopeGuards.py
View file @
5aeb67d3
...
@@ -11,13 +11,14 @@
...
@@ -11,13 +11,14 @@
#
#
##############################################################################
##############################################################################
__version__
=
'$Revision: 1.1
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
8
$'
[
11
:
-
2
]
import
sys
import
sys
import
RestrictedPython
import
RestrictedPython
from
RestrictedPython.Guards
import
safe_builtins
,
full_write_guard
from
RestrictedPython.Guards
import
safe_builtins
,
full_write_guard
from
RestrictedPython.Utilities
import
utility_builtins
from
RestrictedPython.Utilities
import
utility_builtins
from
RestrictedPython.Eval
import
RestrictionCapableEval
from
SecurityManagement
import
getSecurityManager
from
SecurityManagement
import
getSecurityManager
from
SecurityInfo
import
secureModule
from
SecurityInfo
import
secureModule
from
SimpleObjectPolicies
import
Containers
,
ContainerAssertions
from
SimpleObjectPolicies
import
Containers
,
ContainerAssertions
...
@@ -406,3 +407,5 @@ _safe_globals = {'__builtins__': safe_builtins,
...
@@ -406,3 +407,5 @@ _safe_globals = {'__builtins__': safe_builtins,
}
}
get_safe_globals
=
_safe_globals
.
copy
get_safe_globals
=
_safe_globals
.
copy
RestrictionCapableEval
.
globals
.
update
(
_safe_globals
)
lib/python/AccessControl/tests/testSecurity.py
View file @
5aeb67d3
...
@@ -13,8 +13,8 @@
...
@@ -13,8 +13,8 @@
"""Document Template Tests
"""Document Template Tests
"""
"""
__rcs_id__
=
'$Id: testSecurity.py,v 1.1
1 2003/01/27 22:55:27 gvanrossum
Exp $'
__rcs_id__
=
'$Id: testSecurity.py,v 1.1
2 2004/01/16 18:18:51 tseaver
Exp $'
__version__
=
'$Revision: 1.1
1
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
2
$'
[
11
:
-
2
]
import
os
,
sys
,
unittest
import
os
,
sys
,
unittest
...
@@ -78,6 +78,33 @@ class SecurityTests (DTMLTests):
...
@@ -78,6 +78,33 @@ class SecurityTests (DTMLTests):
res
=
html
(
c
=
c
)
res
=
html
(
c
=
c
)
assert
res
==
'10'
,
res
assert
res
==
'10'
,
res
def
testNewDTMLBuiltins
(
self
):
NEW_BUILTINS_TEMPLATE
=
"""
<dtml-var expr="_.min([1,2])">
<dtml-var expr="_.max([2,3])">
<dtml-var expr="_.sum([1,2,3,4])">
<dtml-var expr="[x for x in (1, 2, 3)]">
"""
EXPECTED
=
[
'1'
,
'3'
,
'10'
,
'[1, 2, 3]'
]
#
# XXX: these expressions seem like they should work, with
# the following ExPECTED, but they raise Unauthorized
# on the 'next' name.
#
#<dtml-var expr="_.iter([1,2,3]).next()">
#<dtml-var expr="_.enumerate([1,2,3]).next()">
#
#EXPECTED = ['1', '3', '10', '1', '(0, 1)']
template
=
self
.
doc_class
(
NEW_BUILTINS_TEMPLATE
)
res
=
template
()
lines
=
filter
(
None
,
[
x
.
strip
()
for
x
in
res
.
split
(
'
\
n
'
)])
self
.
assertEqual
(
lines
,
EXPECTED
)
# Note: we need more tests!
# Note: we need more tests!
def
test_suite
():
def
test_suite
():
...
...
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