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
57cfe411
Commit
57cfe411
authored
Jul 02, 2001
by
Shane Hathaway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collector #2357
parent
cbb99bc1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
15 deletions
+45
-15
lib/python/DocumentTemplate/DT_In.py
lib/python/DocumentTemplate/DT_In.py
+29
-10
lib/python/DocumentTemplate/tests/testDTML.py
lib/python/DocumentTemplate/tests/testDTML.py
+16
-5
No files found.
lib/python/DocumentTemplate/DT_In.py
View file @
57cfe411
...
@@ -402,8 +402,8 @@
...
@@ -402,8 +402,8 @@
'''
#'
'''
#'
__rcs_id__
=
'$Id: DT_In.py,v 1.5
2 2001/06/21 17:45:12
shane Exp $'
__rcs_id__
=
'$Id: DT_In.py,v 1.5
3 2001/07/02 16:30:46
shane Exp $'
__version__
=
'$Revision: 1.5
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
3
$'
[
11
:
-
2
]
import
sys
import
sys
from
DT_Util
import
ParseError
,
parse_params
,
name_param
,
str
from
DT_Util
import
ParseError
,
parse_params
,
name_param
,
str
...
@@ -412,6 +412,7 @@ from DT_Util import simple_name, add_with_prefix
...
@@ -412,6 +412,7 @@ from DT_Util import simple_name, add_with_prefix
import
re
import
re
from
DT_InSV
import
sequence_variables
,
opt
from
DT_InSV
import
sequence_variables
,
opt
TupleType
=
type
(())
TupleType
=
type
(())
StringTypes
=
(
type
(
''
),
type
(
u''
))
class
InFactory
:
class
InFactory
:
blockContinuations
=
(
'else'
,)
blockContinuations
=
(
'else'
,)
...
@@ -652,14 +653,23 @@ class InClass:
...
@@ -652,14 +653,23 @@ class InClass:
client
=
sequence
[
index
]
client
=
sequence
[
index
]
pkw
[
'sequence-index'
]
=
index
pkw
[
'sequence-index'
]
=
index
if
type
(
client
)
==
TupleType
and
len
(
client
)
==
2
:
t
=
type
(
client
)
if
t
is
TupleType
and
len
(
client
)
==
2
:
client
=
client
[
1
]
client
=
client
[
1
]
if
mapping
:
push
(
client
)
if
mapping
:
else
:
push
(
InstanceDict
(
client
,
md
))
pushed
=
1
push
(
client
)
elif
t
in
StringTypes
:
pushed
=
0
else
:
pushed
=
1
push
(
InstanceDict
(
client
,
md
))
try
:
append
(
render
(
section
,
md
))
try
:
append
(
render
(
section
,
md
))
finally
:
pop
(
1
)
finally
:
if
pushed
:
pop
()
if
index
==
first
:
pkw
[
'sequence-start'
]
=
0
if
index
==
first
:
pkw
[
'sequence-start'
]
=
0
...
@@ -744,14 +754,23 @@ class InClass:
...
@@ -744,14 +754,23 @@ class InClass:
client
=
sequence
[
index
]
client
=
sequence
[
index
]
pkw
[
'sequence-index'
]
=
index
pkw
[
'sequence-index'
]
=
index
if
type
(
client
)
==
TupleType
and
len
(
client
)
==
2
:
t
=
type
(
client
)
if
t
is
TupleType
and
len
(
client
)
==
2
:
client
=
client
[
1
]
client
=
client
[
1
]
if
mapping
:
push
(
client
)
if
mapping
:
else
:
push
(
InstanceDict
(
client
,
md
))
pushed
=
1
push
(
client
)
elif
t
in
StringTypes
:
pushed
=
0
else
:
pushed
=
1
push
(
InstanceDict
(
client
,
md
))
try
:
append
(
render
(
section
,
md
))
try
:
append
(
render
(
section
,
md
))
finally
:
pop
()
finally
:
if
pushed
:
pop
()
if
index
==
0
:
pkw
[
'sequence-start'
]
=
0
if
index
==
0
:
pkw
[
'sequence-start'
]
=
0
result
=
''
.
join
(
result
)
result
=
''
.
join
(
result
)
...
...
lib/python/DocumentTemplate/tests/testDTML.py
View file @
57cfe411
...
@@ -85,8 +85,8 @@
...
@@ -85,8 +85,8 @@
"""Document Template Tests
"""Document Template Tests
"""
"""
__rcs_id__
=
'$Id: testDTML.py,v 1.
5 2001/05/23 18:03:37
shane Exp $'
__rcs_id__
=
'$Id: testDTML.py,v 1.
6 2001/07/02 16:30:46
shane Exp $'
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
6
$'
[
11
:
-
2
]
import
sys
,
os
import
sys
,
os
import
unittest
import
unittest
...
@@ -108,6 +108,8 @@ def read_file(name):
...
@@ -108,6 +108,8 @@ def read_file(name):
from
DocumentTemplate
import
HTML
,
String
from
DocumentTemplate
import
HTML
,
String
from
ExtensionClass
import
Base
from
ExtensionClass
import
Base
class
D
:
class
D
:
__allow_access_to_unprotected_subobjects__
=
1
def
__init__
(
self
,
**
kw
):
def
__init__
(
self
,
**
kw
):
for
k
,
v
in
kw
.
items
():
self
.
__dict__
[
k
]
=
v
for
k
,
v
in
kw
.
items
():
self
.
__dict__
[
k
]
=
v
...
@@ -476,7 +478,7 @@ foo bar
...
@@ -476,7 +478,7 @@ foo bar
andrew, 5
andrew, 5
chessie, 2
chessie, 2
"""
"""
result
=
HTML
(
html
)(
data
=
data
)
result
=
self
.
doc_class
(
html
)(
data
=
data
)
assert
result
==
expected
,
result
assert
result
==
expected
,
result
def
checkBasicHTMLIn2
(
self
):
def
checkBasicHTMLIn2
(
self
):
...
@@ -491,7 +493,16 @@ foo bar
...
@@ -491,7 +493,16 @@ foo bar
2
2
3
3
"""
"""
result
=
HTML
(
html
)(
xxx
=
xxx
)
result
=
self
.
doc_class
(
html
)(
xxx
=
xxx
)
assert
result
==
expected
,
result
def
checkBasicHTMLIn3
(
self
):
ns
=
{
'prop_ids'
:
(
'title'
,
'id'
),
'title'
:
'good'
,
'id'
:
'times'
}
html
=
""":<dtml-in prop_ids><dtml-var sequence-item>=<dtml-var
expr="_[_['sequence-item']]">:</dtml-in>"""
result
=
self
.
doc_class
(
html
)(
None
,
ns
)
expected
=
":title=good:id=times:"
assert
result
==
expected
,
result
assert
result
==
expected
,
result
def
checkHTMLInElse
(
self
):
def
checkHTMLInElse
(
self
):
...
@@ -510,7 +521,7 @@ foo bar
...
@@ -510,7 +521,7 @@ foo bar
2
2
3
3
"""
"""
result
=
HTML
(
html
)(
xxx
=
xxx
,
data
=
{})
result
=
self
.
doc_class
(
html
)(
xxx
=
xxx
,
data
=
{})
assert
result
==
expected
,
result
assert
result
==
expected
,
result
def
checkBasicStringIn
(
self
):
def
checkBasicStringIn
(
self
):
...
...
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