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
c40ace88
Commit
c40ace88
authored
Mar 06, 1998
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug that caused single-index indexing after a subexpression to
fail.
parent
da34fdb3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
lib/python/DocumentTemplate/gparse.py
lib/python/DocumentTemplate/gparse.py
+31
-4
No files found.
lib/python/DocumentTemplate/gparse.py
View file @
c40ace88
...
...
@@ -140,7 +140,7 @@ def item_munge(ast, i):
append
(
a
)
append
([
COMMA
,
','
])
for
sub
in
ast
[
2
][
2
][
1
:]:
for
sub
in
ast
[
i
][
2
][
1
:]:
if
sub
[
0
]
==
COMMA
:
append
(
sub
)
else
:
if
len
(
sub
)
!=
2
:
raise
ParseError
,
'Invalid slice in subscript'
...
...
@@ -178,8 +178,7 @@ def dot_munge(ast, i):
append
(
a
)
return
[
power
,
[
atom
,
[
NAME
,
'__guarded_getattr__'
]],
[
trailer
,
[
LPAR
,
'('
],
args
,
[
RPAR
,
')'
],
]
[
trailer
,
[
LPAR
,
'('
],
args
,
[
RPAR
,
')'
]],
]
def
multi_munge
(
ast
):
...
...
@@ -223,6 +222,35 @@ def compile(src, file_name, ctype):
l
=
munge
(
l
)
ast
=
sequence2ast
(
l
)
return
parser
.
compileast
(
ast
,
file_name
)
def
check
(
expr1
=
None
,
expr2
=
None
):
ok
=
1
expr1
=
expr1
or
sys
.
argv
[
1
]
expr2
=
expr2
or
sys
.
argv
[
2
]
l1
=
munge
(
astl
(
expr1
))
l2
=
astl
(
expr2
)
try
:
c1
=
compileast
(
sequence2ast
(
l1
))
except
:
traceback
.
print_exc
c1
=
None
c2
=
compileast
(
sequence2ast
(
l2
))
if
c1
!=
c2
:
ok
=
0
print
'test failed'
,
expr1
,
expr2
print
print
l1
print
print
l2
print
ast
=
parser
.
sequence2ast
(
l1
)
c
=
parser
.
compileast
(
ast
)
pretty
(
expr1
)
pret
(
l1
)
pret
(
l2
)
return
ok
def
spam
():
# Regression test
...
...
@@ -272,4 +300,3 @@ if __name__=='__main__':
globals
()[
c
]()
except
:
spam
()
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