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
b035ec17
Commit
b035ec17
authored
Jan 13, 2007
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed code to allow Python's 'set' module
parent
945ec4b5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
5 deletions
+9
-5
doc/CHANGES.txt
doc/CHANGES.txt
+1
-1
lib/python/AccessControl/DTML.py
lib/python/AccessControl/DTML.py
+3
-1
lib/python/AccessControl/ZopeGuards.py
lib/python/AccessControl/ZopeGuards.py
+2
-0
lib/python/Products/PythonScripts/tests/testPythonScript.py
lib/python/Products/PythonScripts/tests/testPythonScript.py
+1
-1
lib/python/RestrictedPython/Utilities.py
lib/python/RestrictedPython/Utilities.py
+2
-2
No files found.
doc/CHANGES.txt
View file @
b035ec17
...
...
@@ -48,7 +48,7 @@ Zope Changes
Features added
- PythonScripts: a
dded 'Set' class to RestrictedPython (Collector #1918)
- PythonScripts: a
llow usage of Python's 'sets' module
- added 'fast_listen' directive to http-server and webdav-source-server
sections in etc/zope.conf in order to defer the opening of the sockets
...
...
lib/python/AccessControl/DTML.py
View file @
b035ec17
...
...
@@ -15,7 +15,7 @@
$Id$
"""
from
DocumentTemplate
import
DT_Util
import
SecurityManagement
,
string
,
math
,
random
import
SecurityManagement
,
string
,
math
,
random
,
sets
import
DocumentTemplate.sequence
from
ZopeGuards
import
safe_builtins
...
...
@@ -28,6 +28,8 @@ DT_Util.TemplateDict.__allow_access_to_unprotected_subobjects__=1
string
.
__allow_access_to_unprotected_subobjects__
=
1
math
.
__allow_access_to_unprotected_subobjects__
=
1
random
.
__allow_access_to_unprotected_subobjects__
=
1
sets
.
__allow_access_to_unprotected_subobjects__
=
1
DocumentTemplate
.
sequence
.
__allow_access_to_unprotected_subobjects__
=
1
...
...
lib/python/AccessControl/ZopeGuards.py
View file @
b035ec17
...
...
@@ -295,6 +295,7 @@ class GuardedListType:
return
list
.
sorted
(
iterable
,
cmp
=
None
,
key
=
None
,
reverse
=
False
)
safe_builtins
[
'list'
]
=
GuardedListType
()
class
GuardedDictType
:
def
__call__
(
self
,
*
args
,
**
kwargs
):
return
dict
(
*
args
,
**
kwargs
)
...
...
@@ -303,6 +304,7 @@ class GuardedDictType:
return
dict
.
fromkeys
(
S
,
v
)
safe_builtins
[
'dict'
]
=
GuardedDictType
()
def
guarded_enumerate
(
seq
):
return
NullIter
(
enumerate
(
guarded_iter
(
seq
)))
safe_builtins
[
'enumerate'
]
=
guarded_enumerate
...
...
lib/python/Products/PythonScripts/tests/testPythonScript.py
View file @
b035ec17
...
...
@@ -206,7 +206,7 @@ class TestPythonScriptNoAq(PythonScriptTestBase):
self
.
assertEqual
(
f
.
get_size
(),
len
(
f
.
read
()))
def
testSet
(
self
):
res
=
self
.
_newPS
(
'return len(Set([1,2,3]))'
)()
res
=
self
.
_newPS
(
'
from sets import Set;
return len(Set([1,2,3]))'
)()
self
.
assertEqual
(
res
,
3
)
def
testDateTime
(
self
):
...
...
lib/python/RestrictedPython/Utilities.py
View file @
b035ec17
...
...
@@ -16,7 +16,7 @@ __version__='$Revision: 1.7 $'[11:-2]
import
string
,
math
,
random
import
DocumentTemplate.sequence
from
DateTime.DateTime
import
DateTime
from
sets
import
Set
import
sets
utility_builtins
=
{}
...
...
@@ -25,7 +25,7 @@ utility_builtins['math'] = math
utility_builtins
[
'random'
]
=
random
utility_builtins
[
'sequence'
]
=
DocumentTemplate
.
sequence
utility_builtins
[
'DateTime'
]
=
DateTime
utility_builtins
[
'
Set'
]
=
Set
utility_builtins
[
'
sets'
]
=
sets
def
same_type
(
arg1
,
*
args
):
...
...
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