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
a7b96a33
Commit
a7b96a33
authored
Feb 09, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise exception (TALESError) for errors rather than printing a message.
parent
f7b94ccd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
lib/python/TAL/DummyEngine.py
lib/python/TAL/DummyEngine.py
+7
-7
No files found.
lib/python/TAL/DummyEngine.py
View file @
a7b96a33
...
@@ -90,7 +90,10 @@ import re
...
@@ -90,7 +90,10 @@ import re
import
string
import
string
from
TALDefs
import
NAME_RE
,
macroIndexer
from
TALDefs
import
NAME_RE
,
macroIndexer
from
TALCompiler
import
TALCompiler
from
TALCompiler
import
TALCompiler
,
TALError
class
TALESError
(
TALError
):
pass
class
DummyEngine
:
class
DummyEngine
:
...
@@ -139,8 +142,7 @@ class DummyEngine:
...
@@ -139,8 +142,7 @@ class DummyEngine:
return
self
.
globals
[
expr
]
return
self
.
globals
[
expr
]
if
type
==
"python"
:
if
type
==
"python"
:
return
eval
(
expr
,
self
.
globals
,
self
.
locals
)
return
eval
(
expr
,
self
.
globals
,
self
.
locals
)
print
"Unrecognized expression:"
,
`expression`
raise
TALESError
(
"unrecognized expression: "
+
`expression`
)
return
None
def
evaluateValue
(
self
,
expr
):
def
evaluateValue
(
self
,
expr
):
return
self
.
evaluate
(
expr
)
return
self
.
evaluate
(
expr
)
...
@@ -171,16 +173,14 @@ class DummyEngine:
...
@@ -171,16 +173,14 @@ class DummyEngine:
# External macro
# External macro
macroDict
=
macroIndexer
(
doc
)
macroDict
=
macroIndexer
(
doc
)
if
not
macroDict
.
has_key
(
localName
):
if
not
macroDict
.
has_key
(
localName
):
print
"Macro"
,
macroName
,
"not found"
raise
TALESError
(
"macro not found: "
+
`macroName`
)
return
macroNode
=
macroDict
[
localName
]
macroNode
=
macroDict
[
localName
]
macro
,
dummy
=
TALCompiler
(
macroNode
)()
macro
,
dummy
=
TALCompiler
(
macroNode
)()
return
macro
return
macro
def
findMacroDocument
(
self
,
macroName
):
def
findMacroDocument
(
self
,
macroName
):
if
not
macroName
:
if
not
macroName
:
print
"Empty macro name:"
,
macroName
raise
TALESError
(
"empty macro name"
)
return
None
,
None
i
=
string
.
rfind
(
macroName
,
'/'
)
i
=
string
.
rfind
(
macroName
,
'/'
)
if
i
<
0
:
if
i
<
0
:
# No slash -- must be a locally defined macro
# No slash -- must be a locally defined macro
...
...
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