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
277d50bc
Commit
277d50bc
authored
May 13, 1998
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved special trick to handle _=_vars here so as to not break other uses
of VSEval.
parent
ddba3619
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
lib/python/DocumentTemplate/DT_Util.py
lib/python/DocumentTemplate/DT_Util.py
+23
-3
No files found.
lib/python/DocumentTemplate/DT_Util.py
View file @
277d50bc
'''$Id: DT_Util.py,v 1.3
2 1998/05/13 21:09:23
jim Exp $'''
'''$Id: DT_Util.py,v 1.3
3 1998/05/13 21:50:14
jim Exp $'''
############################################################################
# Copyright
...
...
@@ -52,7 +52,7 @@
# (540) 371-6909
#
############################################################################
__version__
=
'$Revision: 1.3
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
3
$'
[
11
:
-
2
]
import
sys
,
regex
,
string
,
types
,
math
,
os
from
string
import
rfind
,
strip
,
joinfields
,
atoi
,
lower
,
upper
,
capitalize
...
...
@@ -179,6 +179,22 @@ expr_globals={
'__guarded_getslice__'
:
careful_getslice
,
}
class
Eval
(
VSEval
.
Eval
):
def
eval
(
self
,
mapping
):
d
=
{
'_vars'
:
mapping
,
'_'
:
mapping
}
code
=
self
.
code
globals
=
self
.
globals
for
name
in
self
.
used
:
try
:
d
[
name
]
=
mapping
.
getitem
(
name
,
0
)
except
KeyError
:
if
name
==
'_getattr'
:
d
[
'__builtins__'
]
=
globals
exec
compiled_getattr
in
d
return
eval
(
code
,
globals
,
d
)
def
name_param
(
params
,
tag
=
''
,
expr
=
0
,
attr
=
'name'
,
default_unnamed
=
1
):
used
=
params
.
has_key
__traceback_info__
=
params
,
tag
,
expr
,
attr
...
...
@@ -204,7 +220,7 @@ def name_param(params,tag='',expr=0, attr='name', default_unnamed=1):
return
params
[
attr
]
elif
expr
and
used
(
'expr'
):
name
=
params
[
'expr'
]
expr
=
VSEval
.
Eval
(
name
,
expr_globals
)
expr
=
Eval
(
name
,
expr_globals
)
return
name
,
expr
raise
ParseError
,
(
'No %s given'
,
(
attr
,
tag
))
...
...
@@ -339,6 +355,10 @@ def parse_params(text,
############################################################################
# $Log: DT_Util.py,v $
# Revision 1.33 1998/05/13 21:50:14 jim
# Moved special trick to handle _=_vars here so as to not break other uses
# of VSEval.
#
# Revision 1.32 1998/05/13 21:09:23 jim
# Changed the way that '
_
' is handled. It is now an alias for the template dict.
#
...
...
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