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
58893106
Commit
58893106
authored
Feb 12, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use compilefile() in evaluateMacro(), rather than parsefile().
parent
b8d80e71
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
10 deletions
+18
-10
lib/python/TAL/DummyEngine.py
lib/python/TAL/DummyEngine.py
+18
-10
No files found.
lib/python/TAL/DummyEngine.py
View file @
58893106
...
@@ -165,20 +165,29 @@ class DummyEngine:
...
@@ -165,20 +165,29 @@ class DummyEngine:
return
self
.
evaluate
(
expr
)
return
self
.
evaluate
(
expr
)
def
evaluateMacro
(
self
,
macroName
):
def
evaluateMacro
(
self
,
macroName
):
doc
,
localName
=
self
.
findMacroDocument
(
macroName
)
file
,
localName
=
self
.
findMacroFile
(
macroName
)
if
not
doc
:
if
not
file
:
# Local macro
# Local macro
macro
=
self
.
macros
[
localName
]
macro
=
self
.
macros
[
localName
]
else
:
else
:
# External macro
# External macro
macroDict
=
macroIndexer
(
doc
)
from
driver
import
compilefile
if
not
macroDict
.
has_key
(
localName
):
program
,
macros
=
compilefile
(
file
)
raise
TALESError
(
"macro not found: "
+
`macroName`
)
macro
=
macros
.
get
(
localName
)
macroNode
=
macroDict
[
localName
]
if
not
macro
:
macro
,
dummy
=
TALCompiler
(
macroNode
)()
raise
TALESError
(
"macro %s not found in file %s"
%
(
localName
,
file
))
return
macro
return
macro
def
findMacroDocument
(
self
,
macroName
):
def
findMacroDocument
(
self
,
macroName
):
file
,
localName
=
self
.
findMacroFile
(
macroName
)
if
not
file
:
return
file
,
localName
from
driver
import
parsefile
doc
=
parsefile
(
file
)
return
doc
,
localName
def
findMacroFile
(
self
,
macroName
):
if
not
macroName
:
if
not
macroName
:
raise
TALESError
(
"empty macro name"
)
raise
TALESError
(
"empty macro name"
)
i
=
string
.
rfind
(
macroName
,
'/'
)
i
=
string
.
rfind
(
macroName
,
'/'
)
...
@@ -188,9 +197,8 @@ class DummyEngine:
...
@@ -188,9 +197,8 @@ class DummyEngine:
else
:
else
:
# Up to last slash is the filename
# Up to last slash is the filename
fileName
=
macroName
[:
i
]
fileName
=
macroName
[:
i
]
from
driver
import
parsefile
localName
=
macroName
[
i
+
1
:]
doc
=
parsefile
(
fileName
)
return
fileName
,
localName
return
doc
,
macroName
[
i
+
1
:]
def
setRepeat
(
self
,
name
,
expr
):
def
setRepeat
(
self
,
name
,
expr
):
seq
=
self
.
evaluateSequence
(
expr
)
seq
=
self
.
evaluateSequence
(
expr
)
...
...
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