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
113b82e2
Commit
113b82e2
authored
Oct 02, 2001
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug in tal:on-error handling that messed up other attibutes in
the statement tag.
parent
44d3baa4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
16 deletions
+36
-16
lib/python/TAL/TALGenerator.py
lib/python/TAL/TALGenerator.py
+36
-16
No files found.
lib/python/TAL/TALGenerator.py
View file @
113b82e2
...
...
@@ -94,6 +94,9 @@ from TALDefs import *
class
TALGenerator
:
inMacroUse
=
0
inMacroDef
=
0
def
__init__
(
self
,
expressionCompiler
=
None
,
xml
=
1
):
if
not
expressionCompiler
:
from
DummyEngine
import
DummyEngine
...
...
@@ -341,11 +344,13 @@ class TALGenerator:
if not re.match('%s$' % NAME_RE, macroName):
raise METALError("
invalid
macro
name
:
%
s
" % `macroName`, position)
self.macros[macroName] = program
self.inMacroDef = self.inMacroDef - 1
self.emit("
defineMacro
", macroName, program)
def emitUseMacro(self, expr):
cexpr = self.compileExpression(expr)
program = self.popProgram()
self.inMacroUse = 0
self.emit("
useMacro
", expr, cexpr, self.popSlots(), program)
def emitDefineSlot(self, slotName, position=(None, None)):
...
...
@@ -364,6 +369,7 @@ class TALGenerator:
if not re.match('%s$' % NAME_RE, slotName):
raise METALError("
invalid
slot
name
:
%
s
" % `slotName`, position)
self.slots[slotName] = program
self.inMacroUse = 1
self.emit("
fillSlot
", slotName, program)
def unEmitWhitespace(self):
...
...
@@ -472,21 +478,35 @@ class TALGenerator:
if position != (None, None):
# XXX at some point we should insist on a non-trivial position
self.emit("
setPosition
", position)
if defineMacro:
self.pushProgram()
self.emit("
version
", TAL_VERSION)
self.emit("
mode
", self.xml and "
xml
" or "
html
")
todo["
defineMacro
"] = defineMacro
if useMacro:
self.pushSlots()
self.pushProgram()
todo["
useMacro
"] = useMacro
if fillSlot:
self.pushProgram()
todo["
fillSlot
"] = fillSlot
if defineSlot:
self.pushProgram()
todo["
defineSlot
"] = defineSlot
if self.inMacroUse:
if fillSlot:
self.pushProgram()
todo["
fillSlot
"] = fillSlot
self.inMacroUse = 0
else:
if fillSlot:
raise METALError, ("
fill
-
slot
must
be
within
a
use
-
macro
",
position)
if not self.inMacroUse:
if defineMacro:
self.pushProgram()
self.emit("
version
", TAL_VERSION)
self.emit("
mode
", self.xml and "
xml
" or "
html
")
todo["
defineMacro
"] = defineMacro
self.inMacroDef = self.inMacroDef + 1
if useMacro:
self.pushSlots()
self.pushProgram()
todo["
useMacro
"] = useMacro
self.inMacroUse = 1
if defineSlot:
if not self.inMacroDef:
raise METALError, (
"
define
-
slot
must
be
within
a
define
-
macro
",
position)
self.pushProgram()
todo["
defineSlot
"] = defineSlot
if taldict:
dict = {}
for item in attrlist:
...
...
@@ -496,7 +516,7 @@ class TALGenerator:
todo["
scope
"] = 1
if onError:
self.pushProgram() # handler
self.emitStartTag(name,
attrlist)
self.emitStartTag(name,
list(attrlist)) # Must copy attrlist!
self.pushProgram() # block
todo["
onError
"] = onError
if define:
...
...
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