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
1c9c01ed
Commit
1c9c01ed
authored
Mar 23, 2001
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial checkin as PageTemplates
parent
a67bcdcc
Changes
29
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
3009 additions
and
0 deletions
+3009
-0
lib/python/Products/PageTemplates/Expressions.py
lib/python/Products/PageTemplates/Expressions.py
+355
-0
lib/python/Products/PageTemplates/PageTemplate.py
lib/python/Products/PageTemplates/PageTemplate.py
+215
-0
lib/python/Products/PageTemplates/TALES.py
lib/python/Products/PageTemplates/TALES.py
+285
-0
lib/python/Products/PageTemplates/ZopePageTemplate.py
lib/python/Products/PageTemplates/ZopePageTemplate.py
+339
-0
lib/python/Products/PageTemplates/__init__.py
lib/python/Products/PageTemplates/__init__.py
+96
-0
lib/python/Products/PageTemplates/dtml/default.html
lib/python/Products/PageTemplates/dtml/default.html
+8
-0
lib/python/Products/PageTemplates/dtml/ptAdd.dtml
lib/python/Products/PageTemplates/dtml/ptAdd.dtml
+51
-0
lib/python/Products/PageTemplates/dtml/ptEdit.dtml
lib/python/Products/PageTemplates/dtml/ptEdit.dtml
+123
-0
lib/python/Products/PageTemplates/examples/standard_lf.html
lib/python/Products/PageTemplates/examples/standard_lf.html
+13
-0
lib/python/Products/PageTemplates/examples/welcome.html
lib/python/Products/PageTemplates/examples/welcome.html
+10
-0
lib/python/Products/PageTemplates/tests/__init__.py
lib/python/Products/PageTemplates/tests/__init__.py
+37
-0
lib/python/Products/PageTemplates/tests/batch.py
lib/python/Products/PageTemplates/tests/batch.py
+194
-0
lib/python/Products/PageTemplates/tests/framework.py
lib/python/Products/PageTemplates/tests/framework.py
+138
-0
lib/python/Products/PageTemplates/tests/input/DTML1.html
lib/python/Products/PageTemplates/tests/input/DTML1.html
+19
-0
lib/python/Products/PageTemplates/tests/input/DTML3.html
lib/python/Products/PageTemplates/tests/input/DTML3.html
+33
-0
lib/python/Products/PageTemplates/tests/input/TeeShop1.html
lib/python/Products/PageTemplates/tests/input/TeeShop1.html
+87
-0
lib/python/Products/PageTemplates/tests/input/TeeShop2.html
lib/python/Products/PageTemplates/tests/input/TeeShop2.html
+5
-0
lib/python/Products/PageTemplates/tests/input/TeeShopLAF.html
...python/Products/PageTemplates/tests/input/TeeShopLAF.html
+73
-0
lib/python/Products/PageTemplates/tests/output/DTML1a.html
lib/python/Products/PageTemplates/tests/output/DTML1a.html
+34
-0
lib/python/Products/PageTemplates/tests/output/DTML1b.html
lib/python/Products/PageTemplates/tests/output/DTML1b.html
+7
-0
lib/python/Products/PageTemplates/tests/output/DTML3.html
lib/python/Products/PageTemplates/tests/output/DTML3.html
+30
-0
lib/python/Products/PageTemplates/tests/output/TeeShop1.html
lib/python/Products/PageTemplates/tests/output/TeeShop1.html
+87
-0
lib/python/Products/PageTemplates/tests/output/TeeShop2.html
lib/python/Products/PageTemplates/tests/output/TeeShop2.html
+50
-0
lib/python/Products/PageTemplates/tests/output/TeeShopLAF.html
...ython/Products/PageTemplates/tests/output/TeeShopLAF.html
+73
-0
lib/python/Products/PageTemplates/tests/testDTMLTests.py
lib/python/Products/PageTemplates/tests/testDTMLTests.py
+186
-0
lib/python/Products/PageTemplates/tests/testExpressions.py
lib/python/Products/PageTemplates/tests/testExpressions.py
+21
-0
lib/python/Products/PageTemplates/tests/testHTMLTests.py
lib/python/Products/PageTemplates/tests/testHTMLTests.py
+146
-0
lib/python/Products/PageTemplates/tests/testTALES.py
lib/python/Products/PageTemplates/tests/testTALES.py
+118
-0
lib/python/Products/PageTemplates/tests/util.py
lib/python/Products/PageTemplates/tests/util.py
+176
-0
No files found.
lib/python/Products/PageTemplates/Expressions.py
0 → 100644
View file @
1c9c01ed
This diff is collapsed.
Click to expand it.
lib/python/Products/PageTemplates/PageTemplate.py
0 → 100755
View file @
1c9c01ed
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
"""Page Template module
HTML- and XML-based template objects using TAL, TALES, and METAL.
"""
__version__
=
'$Revision: 1.1 $'
[
11
:
-
2
]
import
os
,
sys
,
traceback
from
TAL.TALParser
import
TALParser
from
TAL.HTMLTALParser
import
HTMLTALParser
from
TAL.TALGenerator
import
TALGenerator
from
TAL.TALInterpreter
import
TALInterpreter
from
Expressions
import
getEngine
from
string
import
join
,
strip
,
rstrip
,
split
,
replace
,
lower
,
find
from
cStringIO
import
StringIO
from
ExtensionClass
import
Base
class
MacroCollection
(
Base
):
def
__of__
(
self
,
parent
):
return
parent
.
_v_macros
class
PageTemplate
:
"Page Templates using TAL, TALES, and METAL"
content_type
=
'text/html'
expand
=
1
_v_errors
=
()
_text
=
''
_error_start
=
'<!-- Page Template Diagnostics'
macros
=
MacroCollection
()
def
pt_edit
(
self
,
text
,
content_type
):
if
content_type
and
content_type
!=
self
.
content_type
:
self
.
content_type
=
str
(
content_type
)
if
hasattr
(
text
,
'read'
):
text
=
text
.
read
()
if
self
.
_text
<>
text
:
self
.
write
(
text
)
def
pt_getContext
(
self
):
c
=
{
'template'
:
self
,
'options'
:
{},
'nothing'
:
None
,
'request'
:
None
,
}
parent
=
getattr
(
self
,
'aq_parent'
,
None
)
if
parent
is
not
None
:
c
[
'here'
]
=
parent
c
[
'container'
]
=
self
.
aq_inner
.
aq_parent
while
parent
is
not
None
:
self
=
parent
parent
=
getattr
(
self
,
'aq_parent'
,
None
)
c
[
'root'
]
=
self
return
c
def
pt_render
(
self
,
source
=
0
,
extra_context
=
{}):
"""Render this Page Template"""
if
self
.
_v_errors
:
return
self
.
pt_diagnostic
()
output
=
StringIO
()
c
=
self
.
pt_getContext
()
c
.
update
(
extra_context
)
__traceback_info__
=
c
TALInterpreter
(
self
.
_v_program
,
self
.
_v_macros
,
getEngine
().
getContext
(
c
),
output
,
tal
=
not
source
,
html
=
self
.
html
()
)()
return
output
.
getvalue
()
def
__call__
(
self
,
**
kwargs
):
return
self
.
pt_render
(
extra_context
=
{
'options'
:
kwargs
})
def
pt_diagnostic
(
self
):
return
(
'<html><body>
\
n
'
'<h4>Page Template Diagnostics</h4>
\
n
'
' %s
\
n
'
'</body></html>
\
n
'
)
%
join
(
self
.
_v_errors
,
'
\
n
'
)
def
write
(
self
,
text
):
assert
type
(
text
)
is
type
(
''
)
if
text
[:
len
(
self
.
_error_start
)]
==
self
.
_error_start
:
errend
=
find
(
text
,
'-->'
)
if
errend
>=
0
:
text
=
text
[
errend
+
4
:]
self
.
_text
=
text
self
.
_cook
()
def
read
(
self
):
if
not
self
.
_v_errors
:
if
not
self
.
expand
:
return
self
.
_text
try
:
return
self
.
pt_render
(
source
=
1
)
except
:
tb
=
traceback
.
extract_tb
(
sys
.
exc_info
()[
2
])
tb
.
reverse
()
self
.
_v_errors
=
[
"Macro expansion failed"
,
"%s: %s"
%
sys
.
exc_info
()[:
2
],
]
+
map
(
str
,
tb
)
if
self
.
html
():
return
(
'%s
\
n
%s
\
n
-->
\
n
%s'
%
(
self
.
_error_start
,
join
(
self
.
_v_errors
,
'
\
n
'
),
self
.
_text
))
return
self
.
_text
def
_cook
(
self
):
"""Compile the TAL and METAL statments.
A Page Template must always be cooked, and cooking must not
fail due to user input.
"""
gen
=
TALGenerator
(
getEngine
())
if
self
.
html
():
parser
=
HTMLTALParser
(
gen
)
else
:
parser
=
TALParser
(
gen
)
self
.
_v_errors
=
()
try
:
parser
.
parseString
(
self
.
_text
)
self
.
_v_program
,
self
.
_v_macros
=
parser
.
getCode
()
except
:
self
.
_v_errors
=
[
"Compilation failed"
,
"%s: %s"
%
sys
.
exc_info
()[:
2
]]
def
html
(
self
):
return
self
.
content_type
==
'text/html'
lib/python/Products/PageTemplates/TALES.py
0 → 100644
View file @
1c9c01ed
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
"""TALES
An implementation of a generic TALES engine
"""
__version__
=
'$Revision: 1.1 $'
[
11
:
-
2
]
import
re
,
sys
from
MultiMapping
import
MultiMapping
NAME_RE
=
r"[a-zA-Z][a-zA-Z0-9_]*"
_parse_expr
=
re
.
compile
(
r"(%s):(.*)"
%
NAME_RE
).
match
_valid_name
=
re
.
compile
(
'%s$'
%
NAME_RE
).
match
class
TALESError
(
Exception
):
'''TALES Error'''
class
RegistrationError
(
TALESError
):
'''TALES Type Registration Error'''
class
Iterator
:
'''Simple Iterator class for use in Contexts'''
def
__init__
(
self
,
name
,
seq
,
context
):
self
.
name
=
name
self
.
seq
=
seq
self
.
_context
=
context
self
.
nextIndex
=
0
def
next
(
self
):
i
=
self
.
nextIndex
try
:
item
=
self
.
seq
[
i
]
except
IndexError
:
return
0
self
.
index
=
i
self
.
nextIndex
=
i
+
1
self
.
_context
.
setLocal
(
self
.
name
,
item
)
return
1
def
number
(
self
):
return
self
.
nextIndex
def
sequence_start
(
self
):
return
self
.
nextIndex
==
1
def
sequence_end
(
self
):
try
:
self
.
seq
[
self
.
nextIndex
]
except
IndexError
:
return
1
return
0
class
Engine
:
'''Expression Engine
An instance of this class keeps a mutable collection of expression
type handlers. It can compile expression strings by delegating to
these handlers. It can provide an expression Context, which is
capable of holding state and evaluating compiled expressions.
'''
Iterator
=
Iterator
def
__init__
(
self
,
Iterator
=
None
):
self
.
types
=
{}
if
Iterator
is
not
None
:
self
.
Iterator
=
Iterator
def
registerType
(
self
,
name
,
handler
):
if
not
_valid_name
(
name
):
raise
RegistrationError
,
'Invalid Expression type "%s".'
%
name
types
=
self
.
types
if
types
.
has_key
(
name
):
raise
RegistrationError
,
(
'Multiple registrations for Expression type "%s".'
%
name
)
types
[
name
]
=
handler
def
getTypes
(
self
):
return
self
.
types
def
compile
(
self
,
expression
):
m
=
_parse_expr
(
expression
)
if
m
:
type
,
expr
=
m
.
group
(
1
,
2
)
else
:
type
=
"standard"
expr
=
expression
try
:
handler
=
self
.
types
[
type
]
except
KeyError
:
raise
TALESError
,
(
'Unrecognized expression type "%s".'
%
type
)
try
:
return
handler
(
type
,
expr
,
self
)
except
TypeError
:
return
handler
(
type
,
expr
)
def
getContext
(
self
,
contexts
=
None
,
**
kwcontexts
):
if
contexts
is
not
None
:
if
kwcontexts
:
kwcontexts
.
update
(
contexts
)
else
:
kwcontexts
=
contexts
return
Context
(
self
,
kwcontexts
)
class
Context
:
'''Expression Context
An instance of this class holds context information that it can
use to evaluate compiled expressions.
'''
def
__init__
(
self
,
engine
,
contexts
):
self
.
_engine
=
engine
self
.
contexts
=
contexts
# 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
}
contexts
[
'local'
]
=
lv
=
MultiMapping
()
init_local
=
contexts
.
get
(
'local'
,
None
)
if
init_local
:
lv
.
push
(
init_local
)
contexts
[
'global'
]
=
gv
=
contexts
.
copy
()
gv
[
'standard'
]
=
contexts
contexts
[
'var'
]
=
MultiMapping
(
gv
,
lv
)
contexts
[
'loop'
]
=
MultiMapping
()
def
beginScope
(
self
):
oldctxts
=
self
.
_current_ctxts
self
.
_ctxts_pushed
.
append
(
oldctxts
)
self
.
_current_ctxts
=
ctxts
=
{}
for
ctxname
in
oldctxts
.
keys
():
# Push fresh namespace on each local stack.
ctxts
[
ctxname
]
=
ctx
=
{}
self
.
contexts
[
ctxname
].
push
(
ctx
)
def
endScope
(
self
):
self
.
_current_ctxts
=
ctxts
=
self
.
_ctxts_pushed
.
pop
()
# Pop the ones that were pushed at the beginning of the scope.
for
ctxname
in
ctxts
.
keys
():
ctx
=
self
.
contexts
[
ctxname
].
pop
()
# Make sure there's no circular garbage
ctx
.
clear
()
def
setLocal
(
self
,
name
,
value
):
self
.
_current_ctxts
[
'local'
][
name
]
=
value
def
setGlobal
(
self
,
name
,
value
):
self
.
contexts
[
'global'
][
name
]
=
value
def
setRepeat
(
self
,
name
,
expr
):
expr
=
self
.
evaluate
(
expr
)
it
=
self
.
_engine
.
Iterator
(
name
,
expr
,
self
)
self
.
_current_ctxts
[
'loop'
][
name
]
=
it
return
it
def
evaluate
(
self
,
expression
):
if
type
(
expression
)
is
type
(
''
):
expression
=
self
.
_engine
.
compile
(
expression
)
try
:
return
expression
(
self
)
except
:
raise
TALESError
,
"%s
\
n
%s"
%
(
expression
,
"%s:%s"
%
sys
.
exc_info
()[:
2
])
evaluateValue
=
evaluate
def
evaluateBoolean
(
self
,
expr
):
return
not
not
self
.
evaluate
(
expr
)
def
evaluateText
(
self
,
expr
):
text
=
self
.
evaluate
(
expr
)
if
text
is
not
None
:
text
=
str
(
text
)
return
text
def
evaluateStructure
(
self
,
expr
):
return
self
.
evaluate
(
expr
)
def
evaluateMacro
(
self
,
expr
):
# XXX Should return None or a macro definition
return
self
.
evaluate
(
expr
)
def
getTALESError
(
self
):
return
TALESError
class
SimpleExpr
:
'''Simple example of an expression type handler'''
def
__init__
(
self
,
name
,
expr
):
self
.
_name
=
name
self
.
_expr
=
expr
def
__call__
(
self
,
econtext
):
return
self
.
_name
,
self
.
_expr
def
__repr__
(
self
):
return
'<SimpleExpr %s %s>'
%
(
self
.
_name
,
`self._expr`
)
lib/python/Products/PageTemplates/ZopePageTemplate.py
0 → 100755
View file @
1c9c01ed
This diff is collapsed.
Click to expand it.
lib/python/Products/PageTemplates/__init__.py
0 → 100644
View file @
1c9c01ed
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
__doc__
=
'''Package wrapper for Page Templates
This wrapper allows the Page Template modules to be segregated in a
separate package.
$Id: __init__.py,v 1.1 2001/03/23 17:19:07 evan Exp $'''
__version__
=
'$$'
[
11
:
-
2
]
def
initialize
(
context
):
# Import lazily, and defer initialization to the module
import
ZopePageTemplate
ZopePageTemplate
.
initialize
(
context
)
lib/python/Products/PageTemplates/dtml/default.html
0 → 100644
View file @
1c9c01ed
<html>
<head>
<title
tal:insert=
"template/title"
>
The title
</title>
</head>
<body>
This is Page Template
<span
tal:replace=
"template/title"
/>
.
</body>
</html>
lib/python/Products/PageTemplates/dtml/ptAdd.dtml
0 → 100644
View file @
1c9c01ed
<dtml-var manage_page_header>
<dtml-var expr="manage_form_title(this(), _,
form_title='Add Page Template',
)">
<p class="form-help">
Page Templates allow you to use simple HTML or XML attributes to
create dynamic templates. You may choose to upload the template text
from a local file by typing the file name or using the <em>browse</em>
button.
</p>
<form action="manage_addPageTemplate" method="post"
enctype="multipart/form-data">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="top">
<div class="form-label">
Id
</div>
</td>
<td align="left" valign="top">
<input type="text" name="id" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-optional">
File
</div>
</td>
<td align="left" valign="top">
<input type="file" name="file" size="25" value="" />
</td>
</tr>
<tr>
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<div class="form-element">
<input class="form-element" type="submit" name="submit"
value=" Add " />
<input class="form-element" type="submit" name="submit"
value=" Add and Edit " />
</div>
</td>
</tr>
</table>
</form>
<dtml-var manage_page_footer>
lib/python/Products/PageTemplates/dtml/ptEdit.dtml
0 → 100644
View file @
1c9c01ed
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<dtml-comment>Do read at top so we can catch errors</dtml-comment>
<dtml-let read=read>
<form action="&dtml-URL1;" method="post">
<input type="hidden" name=":default_method" value="pt_changePrefs">
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="middle">
<div class="form-optional">
Title
</div>
</td>
<td align="left" valign="middle">
<input type="text" name="title" size="40"
value="&dtml-title;" />
</td>
<td align="left" valign="middle">
<div class="form-optional">
Content-Type
</div>
</td>
<td align="left" valign="middle">
<input type="text" name="content_type" size="14"
value="&dtml-content_type;" />
</td>
</tr>
<tr>
<td align="left" valign="middle">
<div class="form-label">
Last Modified
</div>
</td>
<td align="left" valign="middle">
<div class="form-text">
<dtml-var bobobase_modification_time fmt="%Y-%m-%d %I:%M %p">
</div>
</td>
<td align="left" valign="top" colspan=2>
<dtml-if html>
<a href="source.html">Browse HTML source</a>
<dtml-else>
<a href="source.xml">Browse XML source</a>
</dtml-if>
<br>
<input type="hidden" name="expand:int:default" value="0">
<dtml-if expand>
<input type="checkbox" value="1" name="expand:int" checked>
<dtml-else>
<input type="checkbox" value="1" name="expand:int">
</dtml-if>
Expand macros when editing
</td>
</tr>
<tr>
<td align="left" valign="top" colspan="4">
<div style="width: 100%;">
<textarea name="text:text" wrap="off" style="width: 100%;"
cols=<dtml-var dtpref_cols html_quote missing="50">
rows=<dtml-var dtpref_rows html_quote missing="20">>&dtml-read;</textarea>
</div>
</td>
</tr>
<tr>
<td align="left" valign="top" colspan="4">
<div class="form-element">
<dtml-if wl_isLocked>
<em>Locked by WebDAV</em>
<dtml-else>
<input class="form-element" type="submit"
name="pt_editAction:method" value="Save Changes">
</dtml-if>
<input class="form-element" type="submit" name="height" value="Taller">
<input class="form-element" type="submit" name="height" value="Shorter">
<input class="form-element" type="submit" name="width" value="Wider">
<input class="form-element" type="submit" name="width" value="Narrower">
</div>
</td>
</tr>
</table>
</form>
</dtml-let>
<p class="form-help">
You may upload the text for &dtml-title_and_id; using the form below.
Choose an existing file from your local computer by clicking
<em>browse</em> The contents of the file should be HTML or XML. You
may click the following link to <a href="document_src">view or
download</a> the current text.
</p>
<form action="pt_upload" method="post"
enctype="multipart/form-data">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td align="left" valign="top">
<div class="form-label">
File
</div>
</td>
<td align="left" valign="top">
<input type="file" name="file" size="25" value="">
</td>
</tr>
<tr>
<td></td>
<td align="left" valign="top">
<div class="form-element">
<dtml-if wl_isLocked>
<em>Locked by WebDAV</em>
<dtml-else>
<input class="form-element" type="submit" value="Upload File">
</dtml-if>
</div>
</td>
</tr>
</table>
</form>
<dtml-var manage_page_footer>
lib/python/Products/PageTemplates/examples/standard_lf.html
0 → 100644
View file @
1c9c01ed
<?xml version="1.0" ?>
<html
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
xmlns:metal=
"http://xml.zope.org/namespaces/metal"
metal:define-macro=
"master"
>
<head>
<title
tal:insert=
"here/title"
>
The title
</title>
</head>
<body
bgcolor=
"#999999"
>
<span
metal:define-slot=
"main"
>
</span>
<p
tal:insert=
"structure here/ZopeAttributionButton"
></p>
</body>
</html>
lib/python/Products/PageTemplates/examples/welcome.html
0 → 100644
View file @
1c9c01ed
<?xml version="1.0" ?>
<html
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
xmlns:metal=
"http://xml.zope.org/namespaces/metal"
metal:use-macro=
"here/standard_lf/macros/master"
>
<body>
<span
metal:fill-slot=
"main"
>
<p>
Welcome to the machine
</p>
</span>
</body>
</html>
lib/python/Products/PageTemplates/tests/__init__.py
0 → 100644
View file @
1c9c01ed
def
all
():
import
testTALES
return
testTALES
.
test_suite
()
class
harness1
:
def
__init__
(
self
):
self
.
__callstack
=
[]
def
_assert_
(
self
,
name
,
*
args
,
**
kwargs
):
self
.
__callstack
.
append
((
name
,
args
,
kwargs
))
def
_complete_
(
self
):
assert
len
(
self
.
__callstack
)
==
0
,
"Harness methods called"
def
__getattr__
(
self
,
name
):
cs
=
self
.
__callstack
assert
len
(
cs
),
'Unexpected harness method call "%s".'
%
name
assert
cs
[
0
][
0
]
==
name
,
(
'Harness method name "%s" called, "%s" expected.'
%
(
name
,
cs
[
0
][
0
])
)
return
self
.
_method_
def
_method_
(
self
,
*
args
,
**
kwargs
):
name
,
aargs
,
akwargs
=
self
.
__callstack
.
pop
(
0
)
assert
aargs
==
args
,
"Harness method arguments"
assert
akwargs
==
kwargs
,
"Harness method keyword args"
class
harness2
(
harness1
):
def
_assert_
(
self
,
name
,
result
,
*
args
,
**
kwargs
):
self
.
__callstack
.
append
((
name
,
result
,
args
,
kwargs
))
def
_method_
(
self
,
*
args
,
**
kwargs
):
name
,
result
,
aargs
,
akwargs
=
self
.
__callstack
.
pop
(
0
)
assert
aargs
==
args
,
"Harness method arguments"
assert
akwargs
==
kwargs
,
"Harness method keyword args"
return
result
lib/python/Products/PageTemplates/tests/batch.py
0 → 100644
View file @
1c9c01ed
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
######################################################################
# Sequence batching support
import
util
__allow_access_to_unprotected_subobjects__
=
{
'batch'
:
1
}
__roles__
=
None
class
batch
(
util
.
Base
):
"""Create a sequence batch"""
def
__init__
(
self
,
sequence
,
size
,
start
=
0
,
end
=
0
,
orphan
=
3
,
overlap
=
0
):
start
=
start
+
1
start
,
end
,
sz
=
opt
(
start
,
end
,
size
,
orphan
,
sequence
)
self
.
_last
=
end
-
1
self
.
_first
=
start
-
1
self
.
_sequence
=
sequence
self
.
_size
=
size
self
.
_start
=
start
self
.
_end
=
end
self
.
_orphan
=
orphan
self
.
_overlap
=
overlap
def
previous_sequence
(
self
):
return
self
.
_first
def
previous_sequence_end_number
(
self
):
start
,
end
,
spam
=
opt
(
0
,
self
.
_start
-
1
+
self
.
_overlap
,
self
.
_size
,
self
.
_orphan
,
self
.
_sequence
)
return
end
def
previous_sequence_start_number
(
self
):
start
,
end
,
spam
=
opt
(
0
,
self
.
_start
-
1
+
self
.
_overlap
,
self
.
_size
,
self
.
_orphan
,
self
.
_sequence
)
return
start
def
previous_sequence_end_item
(
self
):
start
,
end
,
spam
=
opt
(
0
,
self
.
_start
-
1
+
self
.
_overlap
,
self
.
_size
,
self
.
_orphan
,
self
.
_sequence
)
return
self
.
_sequence
[
end
-
1
]
def
previous_sequence_start_item
(
self
):
start
,
end
,
spam
=
opt
(
0
,
self
.
_start
-
1
+
self
.
_overlap
,
self
.
_size
,
self
.
_orphan
,
self
.
_sequence
)
return
self
.
_sequence
[
start
-
1
]
def
next_sequence_end_number
(
self
):
start
,
end
,
spam
=
opt
(
self
.
_end
+
1
-
self
.
_overlap
,
0
,
self
.
_size
,
self
.
_orphan
,
self
.
_sequence
)
return
end
def
next_sequence_start_number
(
self
):
start
,
end
,
spam
=
opt
(
self
.
_end
+
1
-
self
.
_overlap
,
0
,
self
.
_size
,
self
.
_orphan
,
self
.
_sequence
)
return
start
def
next_sequence_end_item
(
self
):
start
,
end
,
spam
=
opt
(
self
.
_end
+
1
-
self
.
_overlap
,
0
,
self
.
_size
,
self
.
_orphan
,
self
.
_sequence
)
return
self
.
_sequence
[
end
-
1
]
def
next_sequence_start_item
(
self
):
start
,
end
,
spam
=
opt
(
self
.
_end
+
1
-
self
.
_overlap
,
0
,
self
.
_size
,
self
.
_orphan
,
self
.
_sequence
)
return
self
.
_sequence
[
start
-
1
]
def
next_sequence
(
self
):
try
:
self
.
_sequence
[
self
.
_end
]
except
IndexError
:
return
0
else
:
return
1
def
__getitem__
(
self
,
index
):
if
index
>
self
.
_last
:
raise
IndexError
,
index
return
self
.
_sequence
[
index
+
self
.
_first
]
def
opt
(
start
,
end
,
size
,
orphan
,
sequence
):
if
size
<
1
:
if
start
>
0
and
end
>
0
and
end
>=
start
:
size
=
end
+
1
-
start
else
:
size
=
7
if
start
>
0
:
try
:
sequence
[
start
-
1
]
except
:
start
=
len
(
sequence
)
if
end
>
0
:
if
end
<
start
:
end
=
start
else
:
end
=
start
+
size
-
1
try
:
sequence
[
end
+
orphan
-
1
]
except
:
end
=
len
(
sequence
)
elif
end
>
0
:
try
:
sequence
[
end
-
1
]
except
:
end
=
len
(
sequence
)
start
=
end
+
1
-
size
if
start
-
1
<
orphan
:
start
=
1
else
:
start
=
1
end
=
start
+
size
-
1
try
:
sequence
[
end
+
orphan
-
1
]
except
:
end
=
len
(
sequence
)
return
start
,
end
,
size
lib/python/Products/PageTemplates/tests/framework.py
0 → 100644
View file @
1c9c01ed
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
######################################################################
# Set up unit testing framework
#
# The following code should be at the top of every test module:
#
# import os, sys
# execfile(os.path.join(sys.path[0], 'framework.py'))
#
# ...and the following at the bottom:
#
# if __name__ == '__main__':
# main()
import
string
if
sys
.
modules
.
has_key
(
'unittest'
):
# The framework should already be set up
pass
else
:
scriptdir
=
sys
.
path
[
0
]
if
scriptdir
==
''
:
cwd
=
os
.
getcwd
()
while
1
:
for
ext
in
'py'
,
'pyc'
,
'pyo'
,
'pyd'
:
if
os
.
path
.
isfile
(
os
.
path
.
join
(
cwd
,
'unittest.'
+
ext
)):
break
else
:
cwd
,
lastdir
=
os
.
path
.
split
(
cwd
)
if
lastdir
:
continue
break
sys
.
path
.
insert
(
1
,
cwd
)
else
:
sys
.
path
.
insert
(
1
,
''
)
import
unittest
TestRunner
=
unittest
.
TextTestRunner
def
main
():
if
len
(
sys
.
argv
)
>
1
:
globals
()[
sys
.
argv
[
1
]]()
else
:
TestRunner
().
run
(
test_suite
())
def
debug
():
test_suite
().
debug
()
def
pdebug
():
import
pdb
pdb
.
run
(
'debug()'
)
lib/python/Products/PageTemplates/tests/input/DTML1.html
0 → 100644
View file @
1c9c01ed
<html
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
>
<head><title>
Test of documentation templates
</title></head>
<body>
<span
tal:replace=
"nothing"
>
blah
</span>
<dl
tal:condition=
"here/args"
>
<dt>
The arguments to this test program were:
</dt>
<dd>
<ul>
<li
tal:repeat=
"arg here/args"
>
Argument number
<span
tal:replace=
"arg/num"
>
99
</span>
is
<span
tal:replace=
"arg/arg"
>
default
</span>
</li>
</ul>
</dd>
</dl>
<p
tal:condition=
"not:here/args"
>
No arguments were given.
</p>
And thats da trooth.
</body>
</html>
lib/python/Products/PageTemplates/tests/input/DTML3.html
0 → 100644
View file @
1c9c01ed
<head><title>
Test of documentation templates
</title></head>
<body>
<div
tal:condition=
"here/args"
>
The arguments were:
<span
tal:condition=
"options/batch/previous_sequence"
>
(
<span
tal:replace=
"options/batch/previous_sequence_start_item"
>
previous start item
</span>
-
<span
tal:replace=
"options/batch/previous_sequence_end_item"
>
previous end item
</span>
)
</span>
<dl>
<span
tal:repeat=
"arg options/batch"
>
<dt><span
tal:replace=
"local/arg"
>
??
</span>
.
</dt>
<dd>
Argument
<span
tal:define=
"num arg/num"
tal:replace=
"string: $num"
>
99
</span>
was
<span
tal:replace=
"arg"
>
??
</span></dd>
</span>
</dl>
<span
tal:condition=
"options/batch/next_sequence"
>
(
<span
tal:replace=
"options/batch/next_sequence_start_item"
>
next start item
</span>
-
<span
tal:replace=
"options/batch/next_sequence_end_item"
>
next end item
</span>
)
</span>
</div>
<p
tal:condition=
"not:here/args"
>
No arguments were given.
</p>
And I am 100% sure!
</body>
lib/python/Products/PageTemplates/tests/input/TeeShop1.html
0 → 100644
View file @
1c9c01ed
<html
metal:use-macro=
"container/laf/macros/page"
>
<head>
<title>
Zope Stuff
</title>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=iso-8859-1"
>
<link
rel=
"stylesheet"
href=
"/common.css"
>
</head>
<body
bgcolor=
"#FFFFFF"
leftmargin=
"0"
topmargin=
"0"
marginwidth=
"0"
marginheight=
"0"
>
<table
width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
<tr
bgcolor=
"#0000CC"
align=
"center"
>
<td>
<table
width=
"200"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
<tr
bgcolor=
"#FFFFFF"
>
<td><img
src=
"/images/lside.gif"
width=
"52"
height=
"94"
><img
src=
"/images/swlogo.gif"
width=
"150"
height=
"89"
><img
src=
"/images/rside.gif"
width=
"52"
height=
"94"
></td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<table
width=
"300"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
align=
"center"
>
<tr
align=
"center"
>
<td
width=
"25%"
class=
"boldbodylist"
>
apparel
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
mugs
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
toys
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
misc
</td>
</tr>
</table>
<br>
<br>
<div
metal:fill-slot=
"body"
>
<table
width=
"500"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
align=
"center"
>
<tr>
<td
bgcolor=
"#0000CC"
>
<table
width=
"100%"
border=
"0"
cellspacing=
"1"
cellpadding=
"3"
>
<tr
bgcolor=
"#FFFFFF"
align=
"center"
>
<td><img
src=
"/images/welcome.gif"
width=
"293"
height=
"28"
></td>
</tr>
<tr
bgcolor=
"#FFFFFF"
align=
"center"
valign=
"top"
tal:repeat=
"product options/getProducts"
>
<td>
<table
width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"6"
>
<tr>
<td
colspan=
"2"
class=
"bodylist"
height=
"200"
valign=
"top"
><b>
Description:
</b><span
tal:replace=
"product/description"
>
This is the tee for those who LOVE Zope. Show your heart
on your tee.
</span></td>
<td
align=
"right"
width=
"1%"
rowspan=
"2"
>
<p><img
src=
"/images/smlatee.jpg"
width=
"200"
height=
"200"
tal:attributes=
"src string:/images/${product/image}"
></p>
</td>
</tr>
<tr>
<td
class=
"bodylist"
><img
src=
"images/clear.gif"
width=
"150"
height=
"10"
></td>
<td
class=
"bodylist"
><b>
Price
</b>
:
<span
tal:replace=
"product/price"
>
12.99
</span></td>
</tr>
</table>
</td>
</tr>
<tr
bgcolor=
"#FFFFFF"
align=
"center"
valign=
"top"
>
<td>
<table
width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"6"
>
<tr>
<td
align=
"center"
><img
src=
"images/buttons/submit.gif"
width=
"87"
height=
"30"
></td>
<td
align=
"center"
><img
src=
"images/buttons/cancel.gif"
width=
"87"
height=
"30"
></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<p>
</p><table
width=
"100%"
border=
"0"
cellspacing=
"1"
cellpadding=
"3"
align=
"center"
>
<tr
>
<td
align=
"center"
bgcolor=
"#FFFFFF"
class=
"bodylist"
>
Copyright 2000
<a
href=
"http://www.4-am.com"
>
4AM
Productions, Inc.
</a>
. All rights reserved.
<br>
Questions or problems should be directed to
<a
href=
"mailto:webmaster@teamzonline.com"
>
the webmaster
</a>
, 254-412-0846.
</td>
</tr>
<tr>
<td
align=
"center"
><img
src=
"/images/zopelogos/buildzope.gif"
width=
"54"
height=
"54"
></td>
</tr>
</table>
<p>
</p>
</body>
</html>
lib/python/Products/PageTemplates/tests/input/TeeShop2.html
0 → 100644
View file @
1c9c01ed
<html
metal:use-macro=
"container/laf/macros/page"
>
<div
metal:fill-slot=
"body"
>
Body
</div>
</html>
lib/python/Products/PageTemplates/tests/input/TeeShopLAF.html
0 → 100644
View file @
1c9c01ed
<html
metal:define-macro=
"page"
>
<head>
<title>
Zope Stuff
</title>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=iso-8859-1"
/>
<link
rel=
"stylesheet"
href=
"/common.css"
/>
</head>
<body
bgcolor=
"#FFFFFF"
leftmargin=
"0"
topmargin=
"0"
marginwidth=
"0"
marginheight=
"0"
>
<table
width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
<tr
bgcolor=
"#0000CC"
align=
"center"
>
<td>
<table
width=
"200"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
<tr
bgcolor=
"#FFFFFF"
>
<td><img
src=
"/images/lside.gif"
width=
"52"
height=
"94"
/><img
src=
"/images/swlogo.gif"
width=
"150"
height=
"89"
/><img
src=
"/images/rside.gif"
width=
"52"
height=
"94"
/></td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<table
width=
"300"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
align=
"center"
>
<tr
align=
"center"
>
<td
width=
"25%"
class=
"boldbodylist"
>
apparel
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
mugs
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
toys
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
misc
</td>
</tr>
</table>
<br/>
<br/>
<div
metal:define-slot=
"body"
>
<table
width=
"500"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
align=
"center"
>
<tr>
<td
bgcolor=
"#0000CC"
>
<table
width=
"100%"
border=
"0"
cellspacing=
"1"
cellpadding=
"3"
>
<tr
bgcolor=
"#FFFFFF"
align=
"center"
>
<td><img
src=
"/images/welcome.gif"
width=
"293"
height=
"28"
/></td>
</tr>
<tr
bgcolor=
"#FFFFFF"
align=
"center"
valign=
"top"
>
<td>
<br/>
<table
width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"6"
>
<tr>
<td>
This is the tee for those who LOVE Zope. Show your heart on
your tee.
</td>
<td
align=
"right"
width=
"1%"
>
<p><img
src=
"/images/smlatee.jpg"
width=
"200"
height=
"200"
/></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<br/><br/>
<table
width=
"100%"
border=
"0"
cellspacing=
"1"
cellpadding=
"3"
align=
"center"
>
<tr>
<td
align=
"center"
bgcolor=
"#FFFFFF"
class=
"bodylist"
>
Copyright
©
2000
<a
href=
"http://www.4-am.com"
>
4AM Productions, Inc.
</a>
.
All rights reserved.
<br/>
Questions or problems should be directed to
<a
href=
"mailto:webmaster@teamzonline.com"
>
the webmaster
</a>
,
254-412-0846.
</td>
</tr>
<tr>
<td
align=
"center"
><img
src=
"/images/zopelogos/buildzope.gif"
width=
"54"
height=
"54"
/></td>
</tr>
</table>
</body>
</html>
lib/python/Products/PageTemplates/tests/output/DTML1a.html
0 → 100644
View file @
1c9c01ed
<html
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
>
<head><title>
Test of documentation templates
</title></head>
<body>
<dl
tal:condition=
"here/args"
>
<dt>
The arguments to this test program were:
</dt>
<dd>
<ul>
<li
tal:repeat=
"arg here/args"
>
Argument number 1
is one
</li><li
tal:repeat=
"arg here/args"
>
Argument number 2
is two
</li><li
tal:repeat=
"arg here/args"
>
Argument number 3
is three
</li><li
tal:repeat=
"arg here/args"
>
Argument number 4
is cha
</li><li
tal:repeat=
"arg here/args"
>
Argument number 5
is cha
</li><li
tal:repeat=
"arg here/args"
>
Argument number 6
is cha
</li>
</ul>
</dd>
</dl>
And thats da trooth.
</body>
</html>
lib/python/Products/PageTemplates/tests/output/DTML1b.html
0 → 100644
View file @
1c9c01ed
<html
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
>
<head><title>
Test of documentation templates
</title></head>
<body>
<p
tal:condition=
"not:here/args"
>
No arguments were given.
</p>
And thats da trooth.
</body>
</html>
lib/python/Products/PageTemplates/tests/output/DTML3.html
0 → 100644
View file @
1c9c01ed
<head><title>
Test of documentation templates
</title></head>
<body>
<div
tal:condition=
"here/args"
>
The arguments were:
<dl>
<span
tal:repeat=
"arg options/batch"
>
<dt>
one.
</dt>
<dd>
Argument 1 was one
</dd>
</span><span
tal:repeat=
"arg options/batch"
>
<dt>
two.
</dt>
<dd>
Argument 2 was two
</dd>
</span><span
tal:repeat=
"arg options/batch"
>
<dt>
three.
</dt>
<dd>
Argument 3 was three
</dd>
</span><span
tal:repeat=
"arg options/batch"
>
<dt>
four.
</dt>
<dd>
Argument 4 was four
</dd>
</span><span
tal:repeat=
"arg options/batch"
>
<dt>
five.
</dt>
<dd>
Argument 5 was five
</dd>
</span>
</dl>
<span
tal:condition=
"options/batch/next_sequence"
>
(six-ten)
</span>
</div>
And I am 100% sure!
</body>
lib/python/Products/PageTemplates/tests/output/TeeShop1.html
0 → 100644
View file @
1c9c01ed
<html
metal:use-macro=
"container/laf/macros/page"
>
<head>
<title>
Zope Stuff
</title>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=iso-8859-1"
>
<link
rel=
"stylesheet"
href=
"/common.css"
>
</head>
<body
bgcolor=
"#FFFFFF"
leftmargin=
"0"
topmargin=
"0"
marginwidth=
"0"
marginheight=
"0"
>
<table
width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
<tr
bgcolor=
"#0000CC"
align=
"center"
>
<td>
<table
width=
"200"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
<tr
bgcolor=
"#FFFFFF"
>
<td><img
src=
"/images/lside.gif"
width=
"52"
height=
"94"
><img
src=
"/images/swlogo.gif"
width=
"150"
height=
"89"
><img
src=
"/images/rside.gif"
width=
"52"
height=
"94"
></td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<table
width=
"300"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
align=
"center"
>
<tr
align=
"center"
>
<td
width=
"25%"
class=
"boldbodylist"
>
apparel
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
mugs
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
toys
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
misc
</td>
</tr>
</table>
<br>
<br>
<div
metal:fill-slot=
"body"
>
<table
width=
"500"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
align=
"center"
>
<tr>
<td
bgcolor=
"#0000CC"
>
<table
width=
"100%"
border=
"0"
cellspacing=
"1"
cellpadding=
"3"
>
<tr
bgcolor=
"#FFFFFF"
align=
"center"
>
<td><img
src=
"/images/welcome.gif"
width=
"293"
height=
"28"
></td>
</tr>
<tr
bgcolor=
"#FFFFFF"
align=
"center"
valign=
"top"
tal:repeat=
"product options/getProducts"
>
<td>
<table
width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"6"
>
<tr>
<td
colspan=
"2"
class=
"bodylist"
height=
"200"
valign=
"top"
><b>
Description:
</b><span
tal:replace=
"product/description"
>
This is the tee for those who LOVE Zope. Show your heart
on your tee.
</span></td>
<td
align=
"right"
width=
"1%"
rowspan=
"2"
>
<p><img
src=
"/images/smlatee.jpg"
width=
"200"
height=
"200"
tal:attributes=
"src string:/images/${product/image}"
></p>
</td>
</tr>
<tr>
<td
class=
"bodylist"
><img
src=
"images/clear.gif"
width=
"150"
height=
"10"
></td>
<td
class=
"bodylist"
><b>
Price
</b>
:
<span
tal:replace=
"product/price"
>
12.99
</span></td>
</tr>
</table>
</td>
</tr>
<tr
bgcolor=
"#FFFFFF"
align=
"center"
valign=
"top"
>
<td>
<table
width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"6"
>
<tr>
<td
align=
"center"
><img
src=
"images/buttons/submit.gif"
width=
"87"
height=
"30"
></td>
<td
align=
"center"
><img
src=
"images/buttons/cancel.gif"
width=
"87"
height=
"30"
></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<p>
</p><table
width=
"100%"
border=
"0"
cellspacing=
"1"
cellpadding=
"3"
align=
"center"
>
<tr
>
<td
align=
"center"
bgcolor=
"#FFFFFF"
class=
"bodylist"
>
Copyright 2000
<a
href=
"http://www.4-am.com"
>
4AM
Productions, Inc.
</a>
. All rights reserved.
<br>
Questions or problems should be directed to
<a
href=
"mailto:webmaster@teamzonline.com"
>
the webmaster
</a>
, 254-412-0846.
</td>
</tr>
<tr>
<td
align=
"center"
><img
src=
"/images/zopelogos/buildzope.gif"
width=
"54"
height=
"54"
></td>
</tr>
</table>
<p>
</p>
</body>
</html>
lib/python/Products/PageTemplates/tests/output/TeeShop2.html
0 → 100644
View file @
1c9c01ed
<html
metal:use-macro=
"container/laf/macros/page"
>
<head>
<title>
Zope Stuff
</title>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=iso-8859-1"
/>
<link
rel=
"stylesheet"
href=
"/common.css"
/>
</head>
<body
bgcolor=
"#FFFFFF"
leftmargin=
"0"
topmargin=
"0"
marginwidth=
"0"
marginheight=
"0"
>
<table
width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
<tr
bgcolor=
"#0000CC"
align=
"center"
>
<td>
<table
width=
"200"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
<tr
bgcolor=
"#FFFFFF"
>
<td><img
src=
"/images/lside.gif"
width=
"52"
height=
"94"
/><img
src=
"/images/swlogo.gif"
width=
"150"
height=
"89"
/><img
src=
"/images/rside.gif"
width=
"52"
height=
"94"
/></td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<table
width=
"300"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
align=
"center"
>
<tr
align=
"center"
>
<td
width=
"25%"
class=
"boldbodylist"
>
apparel
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
mugs
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
toys
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
misc
</td>
</tr>
</table>
<br/>
<br/>
<div
metal:fill-slot=
"body"
>
Body
</div>
<br/><br/>
<table
width=
"100%"
border=
"0"
cellspacing=
"1"
cellpadding=
"3"
align=
"center"
>
<tr>
<td
align=
"center"
bgcolor=
"#FFFFFF"
class=
"bodylist"
>
Copyright
©
2000
<a
href=
"http://www.4-am.com"
>
4AM Productions, Inc.
</a>
.
All rights reserved.
<br/>
Questions or problems should be directed to
<a
href=
"mailto:webmaster@teamzonline.com"
>
the webmaster
</a>
,
254-412-0846.
</td>
</tr>
<tr>
<td
align=
"center"
><img
src=
"/images/zopelogos/buildzope.gif"
width=
"54"
height=
"54"
/></td>
</tr>
</table>
</body>
</html>
lib/python/Products/PageTemplates/tests/output/TeeShopLAF.html
0 → 100644
View file @
1c9c01ed
<html
metal:define-macro=
"page"
>
<head>
<title>
Zope Stuff
</title>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=iso-8859-1"
/>
<link
rel=
"stylesheet"
href=
"/common.css"
/>
</head>
<body
bgcolor=
"#FFFFFF"
leftmargin=
"0"
topmargin=
"0"
marginwidth=
"0"
marginheight=
"0"
>
<table
width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
<tr
bgcolor=
"#0000CC"
align=
"center"
>
<td>
<table
width=
"200"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
<tr
bgcolor=
"#FFFFFF"
>
<td><img
src=
"/images/lside.gif"
width=
"52"
height=
"94"
/><img
src=
"/images/swlogo.gif"
width=
"150"
height=
"89"
/><img
src=
"/images/rside.gif"
width=
"52"
height=
"94"
/></td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<table
width=
"300"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
align=
"center"
>
<tr
align=
"center"
>
<td
width=
"25%"
class=
"boldbodylist"
>
apparel
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
mugs
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
toys
</td>
<td
width=
"25%"
class=
"boldbodylist"
>
misc
</td>
</tr>
</table>
<br/>
<br/>
<div
metal:define-slot=
"body"
>
<table
width=
"500"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
align=
"center"
>
<tr>
<td
bgcolor=
"#0000CC"
>
<table
width=
"100%"
border=
"0"
cellspacing=
"1"
cellpadding=
"3"
>
<tr
bgcolor=
"#FFFFFF"
align=
"center"
>
<td><img
src=
"/images/welcome.gif"
width=
"293"
height=
"28"
/></td>
</tr>
<tr
bgcolor=
"#FFFFFF"
align=
"center"
valign=
"top"
>
<td>
<br/>
<table
width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"6"
>
<tr>
<td>
This is the tee for those who LOVE Zope. Show your heart on
your tee.
</td>
<td
align=
"right"
width=
"1%"
>
<p><img
src=
"/images/smlatee.jpg"
width=
"200"
height=
"200"
/></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<br/><br/>
<table
width=
"100%"
border=
"0"
cellspacing=
"1"
cellpadding=
"3"
align=
"center"
>
<tr>
<td
align=
"center"
bgcolor=
"#FFFFFF"
class=
"bodylist"
>
Copyright
©
2000
<a
href=
"http://www.4-am.com"
>
4AM Productions, Inc.
</a>
.
All rights reserved.
<br/>
Questions or problems should be directed to
<a
href=
"mailto:webmaster@teamzonline.com"
>
the webmaster
</a>
,
254-412-0846.
</td>
</tr>
<tr>
<td
align=
"center"
><img
src=
"/images/zopelogos/buildzope.gif"
width=
"54"
height=
"54"
/></td>
</tr>
</table>
</body>
</html>
lib/python/Products/PageTemplates/tests/testDTMLTests.py
0 → 100644
View file @
1c9c01ed
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
import
os
,
sys
execfile
(
os
.
path
.
join
(
sys
.
path
[
0
],
'framework.py'
))
import
util
from
Products.PageTemplates.PageTemplate
import
PageTemplate
from
Acquisition
import
Implicit
class
AqPageTemplate
(
Implicit
,
PageTemplate
):
pass
class
DTMLTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
t
=
(
AqPageTemplate
())
def
check1
(
self
):
"""DTML test 1: if, in, and var:
%(comment)[ blah %(comment)]
<html><head><title>Test of documentation templates</title></head>
<body>
%(if args)[
<dl><dt>The arguments to this test program were:<p>
<dd>
<ul>
%(in args)[
<li>Argument number %(num)d was %(arg)s
%(in args)]
</ul></dl><p>
%(if args)]
%(else args)[
No arguments were given.<p>
%(else args)]
And thats da trooth.
</body></html>
"""
tal
=
open
(
'input/DTML1.html'
).
read
()
self
.
t
.
write
(
tal
)
aa
=
util
.
argv
((
'one'
,
'two'
,
'three'
,
'cha'
,
'cha'
,
'cha'
))
o
=
self
.
t
.
__of__
(
aa
)()
expect
=
open
(
'output/DTML1a.html'
).
read
()
util
.
check_xml
(
expect
,
o
)
aa
=
util
.
argv
(())
o
=
self
.
t
.
__of__
(
aa
)()
expect
=
open
(
'output/DTML1b.html'
).
read
()
util
.
check_xml
(
expect
,
o
)
def
check3
(
self
):
"""DTML test 3: batches and formatting:
<html><head><title>Test of documentation templates</title></head>
<body>
<!--#if args-->
The arguments were:
<!--#in args size=size end=end-->
<!--#if previous-sequence-->
(<!--#var previous-sequence-start-arg-->-
<!--#var previous-sequence-end-arg-->)
<!--#/if previous-sequence-->
<!--#if sequence-start-->
<dl>
<!--#/if sequence-start-->
<dt><!--#var sequence-arg-->.</dt>
<dd>Argument <!--#var num fmt=d--> was <!--#var arg--></dd>
<!--#if next-sequence-->
(<!--#var next-sequence-start-arg-->-
<!--#var next-sequence-end-arg-->)
<!--#/if next-sequence-->
<!--#/in args-->
</dl>
<!--#else args-->
No arguments were given.<p>
<!--#/if args-->
And I
\
'
m 100% sure!
</body></html>
"""
tal
=
open
(
'input/DTML3.html'
).
read
()
self
.
t
.
write
(
tal
)
aa
=
util
.
argv
((
'one'
,
'two'
,
'three'
,
'four'
,
'five'
,
'six'
,
'seven'
,
'eight'
,
'nine'
,
'ten'
,
'eleven'
,
'twelve'
,
'thirteen'
,
'fourteen'
,
'fifteen'
,
'sixteen'
,
'seventeen'
,
'eighteen'
,
'nineteen'
,
'twenty'
,
))
import
batch
o
=
self
.
t
.
__of__
(
aa
)(
batch
=
batch
.
batch
(
aa
.
args
,
5
))
expect
=
open
(
'output/DTML3.html'
).
read
()
util
.
check_xml
(
expect
,
o
)
def
test_suite
():
return
unittest
.
makeSuite
(
DTMLTests
,
'check'
)
if
__name__
==
'__main__'
:
main
()
lib/python/Products/PageTemplates/tests/testExpressions.py
0 → 100644
View file @
1c9c01ed
import
os
,
sys
execfile
(
os
.
path
.
join
(
sys
.
path
[
0
],
'framework.py'
))
from
Products.PageTemplates
import
Expressions
class
ExpressionTests
(
unittest
.
TestCase
):
def
testCompile
(
self
):
'''Test expression compilation'''
e
=
Expressions
.
getEngine
()
e
.
compile
(
'x'
)
e
.
compile
(
'path:x'
)
e
.
compile
(
'x/y'
)
e
.
compile
(
'string:Fred'
)
e
.
compile
(
'python: 2 + 2'
)
def
test_suite
():
return
unittest
.
makeSuite
(
ExpressionTests
)
if
__name__
==
'__main__'
:
main
()
lib/python/Products/PageTemplates/tests/testHTMLTests.py
0 → 100644
View file @
1c9c01ed
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
import
os
,
sys
execfile
(
os
.
path
.
join
(
sys
.
path
[
0
],
'framework.py'
))
import
util
from
Products.PageTemplates.PageTemplate
import
PageTemplate
from
Acquisition
import
Implicit
class
AqPageTemplate
(
Implicit
,
PageTemplate
):
pass
class
Folder
(
util
.
Base
):
pass
class
HTMLTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
folder
=
f
=
Folder
()
f
.
laf
=
AqPageTemplate
()
f
.
t
=
AqPageTemplate
()
def
getProducts
(
self
):
return
[
{
'description'
:
'This is the tee for those who LOVE Zope. '
'Show your heart on your tee.'
,
'price'
:
12.99
,
'image'
:
'smlatee.jpg'
},
{
'description'
:
'This is the tee for Jim Fulton. '
'He
\
'
s the Zope Pope!'
,
'price'
:
11.99
,
'image'
:
'smpztee.jpg'
},
]
def
check1
(
self
):
laf
=
self
.
folder
.
laf
laf
.
write
(
open
(
'input/TeeShopLAF.html'
).
read
())
expect
=
open
(
'output/TeeShopLAF.html'
).
read
()
util
.
check_html
(
expect
,
laf
())
def
check2
(
self
):
self
.
folder
.
laf
.
write
(
open
(
'input/TeeShopLAF.html'
).
read
())
t
=
self
.
folder
.
t
t
.
write
(
open
(
'input/TeeShop1.html'
).
read
())
expect
=
open
(
'output/TeeShop1.html'
).
read
()
util
.
check_html
(
expect
,
t
(
getProducts
=
self
.
getProducts
))
def
check3
(
self
):
self
.
folder
.
laf
.
write
(
open
(
'input/TeeShopLAF.html'
).
read
())
t
=
self
.
folder
.
t
t
.
write
(
open
(
'input/TeeShop2.html'
).
read
())
expect
=
open
(
'output/TeeShop2.html'
).
read
()
util
.
check_html
(
expect
,
t
(
getProducts
=
self
.
getProducts
))
def
test_suite
():
return
unittest
.
makeSuite
(
HTMLTests
,
'check'
)
if
__name__
==
'__main__'
:
main
()
lib/python/Products/PageTemplates/tests/testTALES.py
0 → 100644
View file @
1c9c01ed
import
os
,
sys
execfile
(
os
.
path
.
join
(
sys
.
path
[
0
],
'framework.py'
))
from
Products.PageTemplates
import
TALES
from
Products.PageTemplates.tests
import
harness1
import
string
class
TALESTests
(
unittest
.
TestCase
):
def
testIterator0
(
self
):
'''Test sample Iterator class'''
context
=
harness1
()
it
=
TALES
.
Iterator
(
'name'
,
(),
context
)
assert
not
it
.
next
(),
"Empty iterator"
context
.
_complete_
()
def
testIterator1
(
self
):
'''Test sample Iterator class'''
context
=
harness1
()
it
=
TALES
.
Iterator
(
'name'
,
(
1
,),
context
)
context
.
_assert_
(
'setLocal'
,
'name'
,
1
)
assert
it
.
next
()
and
not
it
.
next
(),
"Single-element iterator"
context
.
_complete_
()
def
testIterator2
(
self
):
'''Test sample Iterator class'''
context
=
harness1
()
it
=
TALES
.
Iterator
(
'text'
,
'text'
,
context
)
for
c
in
'text'
:
context
.
_assert_
(
'setLocal'
,
'text'
,
c
)
for
c
in
'text'
:
assert
it
.
next
(),
"Multi-element iterator"
assert
not
it
.
next
(),
"Multi-element iterator"
context
.
_complete_
()
def
testRegisterType
(
self
):
'''Test expression type registration'''
e
=
TALES
.
Engine
()
e
.
registerType
(
'simple'
,
TALES
.
SimpleExpr
)
assert
e
.
getTypes
()[
'simple'
]
==
TALES
.
SimpleExpr
def
testRegisterTypeUnique
(
self
):
'''Test expression type registration uniqueness'''
e
=
TALES
.
Engine
()
e
.
registerType
(
'simple'
,
TALES
.
SimpleExpr
)
try
:
e
.
registerType
(
'simple'
,
TALES
.
SimpleExpr
)
except
TALES
.
RegistrationError
:
pass
else
:
assert
0
,
"Duplicate registration accepted."
def
testRegisterTypeNameConstraints
(
self
):
'''Test constraints on expression type names'''
e
=
TALES
.
Engine
()
for
name
in
'1A'
,
'A!'
,
'AB '
:
try
:
e
.
registerType
(
name
,
TALES
.
SimpleExpr
)
except
TALES
.
RegistrationError
:
pass
else
:
assert
0
,
'Invalid type name "%s" accepted.'
%
name
def
testCompile
(
self
):
'''Test expression compilation'''
e
=
TALES
.
Engine
()
e
.
registerType
(
'simple'
,
TALES
.
SimpleExpr
)
ce
=
e
.
compile
(
'simple:x'
)
assert
ce
(
None
)
==
(
'simple'
,
'x'
),
(
'Improperly compiled expression %s.'
%
`ce`
)
def
testGetContext
(
self
):
'''Test Context creation'''
TALES
.
Engine
().
getContext
()
TALES
.
Engine
().
getContext
(
v
=
1
)
TALES
.
Engine
().
getContext
(
x
=
1
,
y
=
2
)
def
getContext
(
self
,
**
kws
):
e
=
TALES
.
Engine
()
e
.
registerType
(
'simple'
,
TALES
.
SimpleExpr
)
return
apply
(
e
.
getContext
,
(),
kws
)
def
testContext0
(
self
):
'''Test use of Context'''
se
=
self
.
getContext
().
evaluate
(
'simple:x'
)
assert
se
==
(
'simple'
,
'x'
),
(
'Improperly evaluated expression %s.'
%
`se`
)
def
testVariables
(
self
):
'''Test variables'''
ctxt
=
self
.
getContext
()
c
=
ctxt
.
contexts
ctxt
.
beginScope
()
ctxt
.
setLocal
(
'v1'
,
1
)
ctxt
.
setLocal
(
'v2'
,
2
)
assert
c
[
'var'
][
'v1'
]
==
1
,
'Variable "v1"'
ctxt
.
beginScope
()
ctxt
.
setLocal
(
'v1'
,
3
)
ctxt
.
setGlobal
(
'g'
,
1
)
assert
c
[
'var'
][
'v1'
]
==
3
,
'Inner scope'
assert
c
[
'var'
][
'v2'
]
==
2
,
'Outer scope'
assert
c
[
'var'
][
'g'
]
==
1
,
'Global'
ctxt
.
endScope
()
assert
c
[
'var'
][
'v1'
]
==
1
,
"Uncovered local"
assert
c
[
'var'
][
'g'
]
==
1
,
"Global from inner scope"
ctxt
.
endScope
()
def
test_suite
():
return
unittest
.
makeSuite
(
TALESTests
)
if
__name__
==
'__main__'
:
main
()
lib/python/Products/PageTemplates/tests/util.py
0 → 100644
View file @
1c9c01ed
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
######################################################################
# Utility facilities to aid setting things up.
import
os
,
sys
,
string
,
re
from
ExtensionClass
import
Base
class
Bruce
(
Base
):
__allow_access_to_unprotected_subobjects__
=
1
def
__str__
(
self
):
return
'bruce'
def
__int__
(
self
):
return
42
def
__float__
(
self
):
return
42.0
def
keys
(
self
):
return
[
'bruce'
]
*
7
def
values
(
self
):
return
[
self
]
*
7
def
items
(
self
):
return
[(
'bruce'
,
self
)]
*
7
def
__len__
(
self
):
return
7
def
__getitem__
(
self
,
index
):
if
(
type
(
index
)
is
type
(
1
)
and
(
index
<
0
or
index
>
6
)):
raise
IndexError
,
index
return
self
isDocTemp
=
0
def
__getattr__
(
self
,
name
):
if
name
[:
1
]
==
'_'
:
raise
AttributeError
,
name
return
self
bruce
=
Bruce
()
class
arg
(
Base
):
__allow_access_to_unprotected_subobjects__
=
1
def
__init__
(
self
,
nn
,
aa
):
self
.
num
,
self
.
arg
=
nn
,
aa
def
__str__
(
self
):
return
str
(
self
.
arg
)
class
argv
(
Base
):
__allow_access_to_unprotected_subobjects__
=
1
def
__init__
(
self
,
argv
=
sys
.
argv
[
1
:]):
args
=
self
.
args
=
[]
for
aa
in
argv
:
args
.
append
(
arg
(
len
(
args
)
+
1
,
aa
))
def
items
(
self
):
return
map
(
lambda
a
:
(
'spam%d'
%
a
.
num
,
a
),
self
.
args
)
def
values
(
self
):
return
self
.
args
def
getPhysicalRoot
(
self
):
return
self
def
nicerange
(
lo
,
hi
):
if
hi
<=
lo
+
1
:
return
str
(
lo
+
1
)
else
:
return
"%d,%d"
%
(
lo
+
1
,
hi
)
def
check_html
(
s1
,
s2
):
s1
=
normalize_html
(
s1
)
s2
=
normalize_html
(
s2
)
if
s1
!=
s2
:
print
from
OFS.ndiff
import
SequenceMatcher
,
dump
,
IS_LINE_JUNK
a
=
string
.
split
(
s1
,
'
\
n
'
)
b
=
string
.
split
(
s2
,
'
\
n
'
)
def
add_nl
(
s
):
return
s
+
'
\
n
'
a
=
map
(
add_nl
,
a
)
b
=
map
(
add_nl
,
b
)
cruncher
=
SequenceMatcher
(
isjunk
=
IS_LINE_JUNK
,
a
=
a
,
b
=
b
)
for
tag
,
alo
,
ahi
,
blo
,
bhi
in
cruncher
.
get_opcodes
():
if
tag
==
'equal'
:
continue
print
nicerange
(
alo
,
ahi
)
+
tag
[
0
]
+
nicerange
(
blo
,
bhi
)
dump
(
'<'
,
a
,
alo
,
ahi
)
if
a
and
b
:
print
'---'
dump
(
'>'
,
b
,
blo
,
bhi
)
assert
s1
==
s2
,
"HTML Output Changed"
def
check_xml
(
s1
,
s2
):
s1
=
normalize_xml
(
s1
)
s2
=
normalize_xml
(
s2
)
assert
s1
==
s2
,
"XML Output Changed"
def
normalize_html
(
s
):
s
=
re
.
sub
(
r"[ \t]+"
,
" "
,
s
)
s
=
re
.
sub
(
r"/>"
,
">"
,
s
)
return
s
def
normalize_xml
(
s
):
s
=
re
.
sub
(
r"\
s+
", "
", s)
s = re.sub(r"
(
?
s
)
\
s
+<
", "
<
", s)
s = re.sub(r"
(
?
s
)
>
\
s
+
", "
>
", s)
return s
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