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
6400a7a9
Commit
6400a7a9
authored
Oct 27, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed old validation machinery.
parent
a8955db9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
81 deletions
+24
-81
lib/python/DocumentTemplate/DT_Doc.py
lib/python/DocumentTemplate/DT_Doc.py
+3
-22
lib/python/DocumentTemplate/DT_UI.py
lib/python/DocumentTemplate/DT_UI.py
+7
-32
lib/python/DocumentTemplate/DTtest.py
lib/python/DocumentTemplate/DTtest.py
+14
-27
No files found.
lib/python/DocumentTemplate/DT_Doc.py
View file @
6400a7a9
...
...
@@ -68,19 +68,6 @@ Document templates support conditional and sequence insertion
%(In)s
Accessibility of names:
The programmer of a module can specify the visibility of all
attributes available to a Document Template editor in two ways. A
mapping object whose keys are accessible attributes and whose
values are short descriptions can be passed to the document
template. Any name not appearing as a key in that list will not
be acecssible from the document template. In addition to, or as
an alternative to, the mapping object, a validation function can
be specified. The validation function takes the name and the
value of the attribute being accessed as arguments and returns a
non-zero result if the access is allowed.
Document Templates may be created 4 ways:
DocumentTemplate.String -- Creates a document templated from a
...
...
@@ -213,7 +200,7 @@ HTML__doc__="""HTML Document Templates
<!--#/if args-->
And I'm 100% sure!
</body></html>
'''
, __names__={'num':'number', 'arg':'argument'}
)(aa)
''')(aa)
# This is a basic example of batch processing.
...
...
@@ -257,10 +244,7 @@ HTML__doc__="""HTML Document Templates
<!--#/in inventory-->
</dl>
</body></html>
''', __names__={'dealer':'Dealer name',
'make':'Make of car',
'model':'Car model',
'year':'Year of manufacture'})
''')
print html(inventory=RDB.File("dealer-inventory.rdb"), first_car=18)
...
...
@@ -311,10 +295,7 @@ HTML__doc__="""HTML Document Templates
<!--#/in inventory-->
</dl>
</body></html>
''', __names__={'dealer':'Dealer name',
'make':'Make of car',
'model':'Car model',
'year':'Year of manufacture'})
''')
print html(inventory=RDB.File("dealer-inventory.rdb"), first_car=18)
...
...
lib/python/DocumentTemplate/DT_UI.py
View file @
6400a7a9
__doc__
=
'''Machinery to support through-the-web editing
$Id: DT_UI.py,v 1.
2 1997/09/02 19:04:52
jim Exp $'''
$Id: DT_UI.py,v 1.
3 1997/10/27 17:37:13
jim Exp $'''
############################################################################
# Copyright
...
...
@@ -55,7 +55,7 @@ $Id: DT_UI.py,v 1.2 1997/09/02 19:04:52 jim Exp $'''
# (540) 371-6909
#
############################################################################
__version__
=
'$Revision: 1.
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
3
$'
[
11
:
-
2
]
from
DT_HTML
import
HTML
...
...
@@ -109,35 +109,11 @@ HTML._manage_editForm = HTML(
</center>
</FORM>
<!--#if vars-->
<p>The following variables may be used in this template:</p>
<table border>
<tr>
<th>Variables
<th>Description
<!--#in vars-->
<tr>
<td><!--#var sequence-key--></td>
<td><!--#var __str__--></td>
</tr>
<!--#/in vars-->
</table>
<!--#/if vars-->
<BR CLEAR="ALL">
<!--#var document_template_edit_footer-->
</BODY>
</HTML>"""
,
#"
__names__
=
{
'HTTP_REFERER'
:
'Referring URL'
,
'PARENT_URL'
:
"This page's parent"
,
'document_template_edit_header'
:
"(internal)"
,
'document_template_edit_footer'
:
"(internal)"
,
'__str__'
:
"(internal)"
,
'vars'
:
'list of DTML variables you can manipulate'
,
'descrip'
:
'desciption of DTML variables you can manipulate'
,
})
</HTML>"""
,)
HTML
.
editConfirmation
=
HTML
(
"""<html><head><title>Change Successful</title></head><body>
...
...
@@ -152,14 +128,13 @@ HTML.editConfirmation=HTML(
<center>
<em><!--#var dt_edit_name--></em><br>has been changed.
</center>
<!--#/if CANCEL_ACTION-->"""
,
#"
__names__
=
{
'CANCEL_ACTION'
:
'???'
,
'PARENT_URL'
:
"This page's parent"
,
})
<!--#/if CANCEL_ACTION-->"""
)
############################################################################
# $Log: DT_UI.py,v $
# Revision 1.3 1997/10/27 17:37:13 jim
# Removed old validation machinery.
#
# Revision 1.2 1997/09/02 19:04:52 jim
# Got rid of ^Ms
#
...
...
lib/python/DocumentTemplate/DTtest.py
View file @
6400a7a9
...
...
@@ -2,7 +2,7 @@
"""Document Template Tests
"""
__rcs_id__
=
'$Id: DTtest.py,v 1.
1 1997/08/27 18:55:44
jim Exp $'
__rcs_id__
=
'$Id: DTtest.py,v 1.
2 1997/10/27 17:40:02
jim Exp $'
############################################################################
# Copyright
...
...
@@ -56,7 +56,7 @@ __rcs_id__='$Id: DTtest.py,v 1.1 1997/08/27 18:55:44 jim Exp $'
# (540) 371-6909
#
############################################################################
__version__
=
'$Revision: 1.
1
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
2
$'
[
11
:
-
2
]
from
DocumentTemplate
import
*
import
sys
...
...
@@ -116,7 +116,7 @@ def test1():
%(else args)]
And thats da trooth.
</body></html>
"""
,
__names__
=
{
'args'
:
'args'
,
'num'
:
1
}
)
"""
)
print
ss
(
aa
)
...
...
@@ -160,7 +160,7 @@ def test2():
<!--#/if values-->
And I
\
'
m 100% sure!
</body></html>
'''
,
__names__
=
{
'values'
:
'doc'
}
)(
aa
)
'''
)(
aa
)
def
test3
():
test2
()
...
...
@@ -194,7 +194,7 @@ def test3():
<!--#/if args-->
And I
\
'
m 100% sure!
</body></html>
'''
,
__validator__
=
test3_okay
)
'''
)
size
,
orphan
=
5
,
0
for
end
in
range
(
20
):
...
...
@@ -312,19 +312,10 @@ def test4():
<!--#/in inventory-->
</dl>
</body></html>
'''
,
__validator__
=
test4_okay
)
'''
)
print
html
(
inventory
=
items
,
first_ad
=
15
)
def
test4_okay
(
key
,
val
):
global
cache
try
:
x
=
cache
except
NameError
:
cache
=
{}
if
not
cache
.
has_key
(
key
):
print
'Validating'
,
key
cache
[
key
]
=
1
return
1
def
test5
():
html
=
HTML
(
'''
\
...
...
@@ -357,7 +348,7 @@ def test5():
</CENTER>
</body>
</html>'''
,
__names__
=
{
'affiliates'
:
'empty'
,
'PARENT_URL'
:
'www'
}
)
</html>'''
)
print
html
(
affiliates
=
[],
PARENT_URL
=
'www'
)
...
...
@@ -392,7 +383,7 @@ def test6():
---------------
<!--#/if sequence-end-->
<!--#/in data-->
"""
,
__names__
=
{
'data'
:
'list of names and ages'
}
)
"""
)
print
html
(
data
=
data
)
def
test7
():
...
...
@@ -411,14 +402,9 @@ def test8():
%(name capitalize spacify)s is
%(date fmt=year)s/%(date fmt=month)s/%(date fmt=day)s
"""
)
html
.
validator
(
test8_okay
)
print
html
(
date
=
DateTime
.
DateTime
(),
name
=
'todays_date'
)
def
test8_okay
(
key
,
val
):
print
'Validating'
,
key
return
1
def
test9
():
html
=
HTML
(
"""
...
...
@@ -427,12 +413,10 @@ def test9():
<!--#var sequence-item-->
<!--#/in sequence-item-->
<!--#/in spam-->
"""
,
__names__
=
{
'spam'
:
'spam'
})
html
.
validator
(
test8_okay
)
"""
)
print
html
(
spam
=
[[
1
,
2
,
3
],[
4
,
5
,
6
]])
def
test9a
():
# no name validation - should raise KeyError...
html
=
HTML
(
"""
<!--#in spam-->
...
...
@@ -448,7 +432,7 @@ def test10():
html
=
HTML
(
"""
<!--#var spam fmt="$%.2f bob's your uncle" null="spam%eggs!|"-->
"""
,
__names__
=
{
'spam'
:
'spam'
})
#"
"""
)
print
html
(
spam
=
42
)
print
html
(
spam
=
None
)
#print html(spam=Missing.Value)
...
...
@@ -467,7 +451,7 @@ def test11():
dollars,: <!--#var spam fmt=dollars-with-commas-->
cents,: <!--#var spam fmt=dollars-and-cents-with-commas-->
"""
,
__names__
=
{
'spam'
:
'spam'
}
)
"""
)
print
html
(
spam
=
4200000
)
print
html
(
spam
=
None
)
...
...
@@ -548,6 +532,9 @@ if __name__ == "__main__":
############################################################################
# $Log: DTtest.py,v $
# Revision 1.2 1997/10/27 17:40:02 jim
# Removed old validation machinery.
#
# Revision 1.1 1997/08/27 18:55:44 jim
# initial
#
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