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
2f0246dc
Commit
2f0246dc
authored
Mar 10, 1998
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Newlines (and carriage-returns are now allowed in expressions.
parent
60d7df29
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
lib/python/DocumentTemplate/VSEval.py
lib/python/DocumentTemplate/VSEval.py
+12
-4
No files found.
lib/python/DocumentTemplate/VSEval.py
View file @
2f0246dc
"""Very Safe Python Expressions
"""
__rcs_id__
=
'$Id: VSEval.py,v 1.
9 1997/11/21 16:47:1
1 jim Exp $'
__rcs_id__
=
'$Id: VSEval.py,v 1.
10 1998/03/10 17:30:4
1 jim Exp $'
############################################################################
# Copyright
...
...
@@ -11,10 +11,12 @@ __rcs_id__='$Id: VSEval.py,v 1.9 1997/11/21 16:47:11 jim Exp $'
# rights reserved.
#
############################################################################
__version__
=
'$Revision: 1.
9
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
10
$'
[
11
:
-
2
]
from
string
import
join
import
sys
,
gparse
from
string
import
join
,
find
,
split
,
translate
import
sys
,
gparse
,
string
nltosp
=
string
.
maketrans
(
'
\
r
\
n
'
,
' '
)
def
default_slicer
(
env
,
s
,
*
ind
):
l
=
len
(
ind
)
...
...
@@ -43,6 +45,8 @@ default_globals={
'__guarded_getslice__'
:
default_slicer
,
}
class
Eval
:
"""Provide a very-safe environment for evaluating expressions
...
...
@@ -69,6 +73,7 @@ class Eval:
globals -- A global namespace.
"""
expr
=
translate
(
expr
,
nltosp
)
self
.
expr
=
expr
self
.
globals
=
globals
...
...
@@ -118,6 +123,9 @@ class Eval:
############################################################################
#
# $Log: VSEval.py,v $
# Revision 1.10 1998/03/10 17:30:41 jim
# Newlines (and carriage-returns are now allowed in expressions.
#
# Revision 1.9 1997/11/21 16:47:11 jim
# Got rid of non-needed and non-portable import of new.
#
...
...
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