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
e8f4e48f
Commit
e8f4e48f
authored
Sep 25, 2001
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make METAL names strictly follow NAME_RE pattern, with leading and
following whitespace ignored.
parent
d380a9c3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
lib/python/TAL/TALGenerator.py
lib/python/TAL/TALGenerator.py
+13
-4
No files found.
lib/python/TAL/TALGenerator.py
View file @
e8f4e48f
...
...
@@ -334,9 +334,12 @@ class TALGenerator:
def emitDefineMacro(self, macroName, position=(None, None)):
program = self.popProgram()
macroName = string.strip(macroName)
if self.macros.has_key(macroName):
raise METALError("
duplicate
macro
definition
:
%
s
" %
macroName
,
raise METALError("
duplicate
macro
definition
:
%
s
" %
`macroName`
,
position)
if not re.match('%s$' % NAME_RE, macroName):
raise METALError("
invalid
macro
name
:
%
s
" % `macroName`, position)
self.macros[macroName] = program
self.emit("
defineMacro
", macroName, program)
...
...
@@ -345,15 +348,21 @@ class TALGenerator:
program = self.popProgram()
self.emit("
useMacro
", expr, cexpr, self.popSlots(), program)
def emitDefineSlot(self, slotName):
def emitDefineSlot(self, slotName
, position=(None, None)
):
program = self.popProgram()
slotName = string.strip(slotName)
if not re.match('%s$' % NAME_RE, slotName):
raise METALError("
invalid
slot
name
:
%
s
" % `slotName`, position)
self.emit("
defineSlot
", slotName, program)
def emitFillSlot(self, slotName, position=(None, None)):
program = self.popProgram()
slotName = string.strip(slotName)
if self.slots.has_key(slotName):
raise METALError("
duplicate
fill
-
slot
name
:
%
s
" %
slotName
,
raise METALError("
duplicate
fill
-
slot
name
:
%
s
" %
`slotName`
,
position)
if not re.match('%s$' % NAME_RE, slotName):
raise METALError("
invalid
slot
name
:
%
s
" % `slotName`, position)
self.slots[slotName] = program
self.emit("
fillSlot
", slotName, program)
...
...
@@ -580,7 +589,7 @@ class TALGenerator:
if scope:
self.emit("
endScope
")
if defineSlot:
self.emitDefineSlot(defineSlot)
self.emitDefineSlot(defineSlot
, position
)
if fillSlot:
self.emitFillSlot(fillSlot, position)
if useMacro:
...
...
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