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
bf2a6131
Commit
bf2a6131
authored
Feb 15, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly implement insertStructure. Exception: attribute replacement
still isn't supported when using replace -- too bad.
parent
be5b8dfd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
lib/python/TAL/TALInterpreter.py
lib/python/TAL/TALInterpreter.py
+15
-9
No files found.
lib/python/TAL/TALInterpreter.py
View file @
bf2a6131
...
@@ -90,6 +90,7 @@ import sys
...
@@ -90,6 +90,7 @@ import sys
import
string
import
string
import
getopt
import
getopt
import
cgi
import
cgi
from
XMLParser
import
XMLParser
BOOLEAN_HTML_ATTRS
=
[
BOOLEAN_HTML_ATTRS
=
[
# List of Boolean attributes in HTML that should be rendered in
# List of Boolean attributes in HTML that should be rendered in
...
@@ -226,21 +227,26 @@ class TALInterpreter:
...
@@ -226,21 +227,26 @@ class TALInterpreter:
text
=
cgi
.
escape
(
text
)
text
=
cgi
.
escape
(
text
)
self
.
stream_write
(
text
)
self
.
stream_write
(
text
)
def
do_insertStructure
(
self
,
expr
,
block
):
def
do_insertStructure
(
self
,
expr
,
repldict
,
block
):
if
not
self
.
tal
:
if
not
self
.
tal
:
self
.
interpret
(
block
)
self
.
interpret
(
block
)
return
return
structure
=
self
.
engine
.
evaluateStructure
(
expr
)
structure
=
self
.
engine
.
evaluateStructure
(
expr
)
if
structure
is
None
:
if
structure
is
None
:
return
return
raise
TALError
(
"insertStructure() not implemented"
)
if
repldict
:
program
,
macros
=
XXX
# not implemented
raise
TALError
(
saveMacros
=
self
.
macros
"replace structure with attribute replacements not yet implemented"
)
if
macros
:
text
=
str
(
structure
)
self
.
macros
=
saveMacros
.
copy
()
self
.
checkXMLSyntax
(
text
)
self
.
macros
.
update
(
macros
)
self
.
stream_write
(
text
)
# No quoting -- this is intentional
self
.
interpret
(
program
)
self
.
macros
=
saveMacros
def
checkXMLSyntax
(
self
,
text
):
# XXX This is a bit of a hack!
text
=
'<!DOCTYPE foo PUBLIC "foo" "bar"><foo>%s</foo>'
%
text
p
=
XMLParser
()
p
.
parseString
(
text
)
# If this succeeds without errors, we're fine
def
do_loop
(
self
,
name
,
expr
,
block
):
def
do_loop
(
self
,
name
,
expr
,
block
):
if
not
self
.
tal
:
if
not
self
.
tal
:
...
...
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