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
6b06cd66
Commit
6b06cd66
authored
Apr 11, 2001
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix repeat variable
parent
1b45e39a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
10 deletions
+21
-10
lib/python/Products/PageTemplates/Expressions.py
lib/python/Products/PageTemplates/Expressions.py
+4
-1
lib/python/Products/PageTemplates/TALES.py
lib/python/Products/PageTemplates/TALES.py
+5
-4
lib/python/Products/PageTemplates/tests/input/Loop1.html
lib/python/Products/PageTemplates/tests/input/Loop1.html
+3
-2
lib/python/Products/PageTemplates/tests/output/Loop1.html
lib/python/Products/PageTemplates/tests/output/Loop1.html
+9
-3
No files found.
lib/python/Products/PageTemplates/Expressions.py
View file @
6b06cd66
...
...
@@ -89,7 +89,7 @@ Page Template-specific implementation of TALES, with handlers
for Python expressions, Python string literals, and paths.
"""
__version__
=
'$Revision: 1.
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
7
$'
[
11
:
-
2
]
import
re
,
sys
from
TALES
import
Engine
,
CompilerError
,
_valid_name
,
NAME_RE
...
...
@@ -167,6 +167,9 @@ class PathExpr:
ob
=
var
[
base
]
else
:
ob
=
contexts
[
base
]
# Work around lack of security declaration
if
path
and
(
ob
is
contexts
[
'repeat'
]):
ob
=
ob
[
path
.
pop
(
0
)]
ob
=
restrictedTraverse
(
ob
,
path
)
except
(
AttributeError
,
KeyError
):
if
self
.
_name
==
'exists'
:
...
...
lib/python/Products/PageTemplates/TALES.py
View file @
6b06cd66
...
...
@@ -87,7 +87,7 @@
An implementation of a generic TALES engine
"""
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
import
re
,
sys
from
MultiMapping
import
MultiMapping
...
...
@@ -209,7 +209,7 @@ class Context:
# Keep track of what contexts get pushed as each scope begins.
self
.
_ctxts_pushed
=
[]
# These contexts will need to be pushed.
self
.
_current_ctxts
=
{
'local'
:
1
,
'
loop
'
:
1
}
self
.
_current_ctxts
=
{
'local'
:
1
,
'
repeat
'
:
1
}
contexts
[
'local'
]
=
lv
=
MultiMapping
()
init_local
=
contexts
.
get
(
'local'
,
None
)
...
...
@@ -218,7 +218,8 @@ class Context:
contexts
[
'global'
]
=
gv
=
contexts
.
copy
()
gv
[
'standard'
]
=
contexts
contexts
[
'var'
]
=
MultiMapping
(
gv
,
lv
)
contexts
[
'loop'
]
=
MultiMapping
()
contexts
[
'repeat'
]
=
rep
=
MultiMapping
()
contexts
[
'loop'
]
=
rep
# alias
def
beginScope
(
self
):
oldctxts
=
self
.
_current_ctxts
...
...
@@ -246,7 +247,7 @@ class Context:
def
setRepeat
(
self
,
name
,
expr
):
expr
=
self
.
evaluate
(
expr
)
it
=
self
.
_engine
.
Iterator
(
name
,
expr
,
self
)
self
.
_current_ctxts
[
'
loop
'
][
name
]
=
it
self
.
_current_ctxts
[
'
repeat
'
][
name
]
=
it
return
it
def
evaluate
(
self
,
expression
):
...
...
lib/python/Products/PageTemplates/tests/input/Loop1.html
View file @
6b06cd66
...
...
@@ -6,8 +6,9 @@
<p>
Choose your type:
</p>
<ul>
<li
tal:repeat=
"type python:'digital', 'analog', 'organic'"
>
<a
href=
"dummy"
tal:attributes=
"href string:/mach/$type"
tal:content=
"type"
>
selection
</a>
<a
href=
"dummy"
tal:attributes=
"href string:/mach/$type"
>
<span
tal:replace=
"repeat/type/number"
>
1
</span>
.
<span
tal:replace=
"type"
>
selection
</span></a>
</li>
</ul>
</body>
...
...
lib/python/Products/PageTemplates/tests/output/Loop1.html
View file @
6b06cd66
...
...
@@ -6,13 +6,19 @@
<p>
Choose your type:
</p>
<ul>
<li>
<a
href=
"/mach/digital"
>
digital
</a>
<a
href=
"/mach/digital"
>
1.
digital
</a>
</li>
<li>
<a
href=
"/mach/analog"
>
analog
</a>
<a
href=
"/mach/analog"
>
2.
analog
</a>
</li>
<li>
<a
href=
"/mach/organic"
>
organic
</a>
<a
href=
"/mach/organic"
>
3.
organic
</a>
</li>
</ul>
</body>
...
...
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