[[\
import urllib, os.path
# The child variable is automatically injected into a parent template's context.
# it contains the '_body' key which holds any text generated by the child,
# as well as any other (string) keys passed as attributes to the spy:parent tag.
# These may be accessed as child['foo'] or child.foo.
L = child.get('extracode', [])
L.append(('parent template', request.filename()))
# check the filesystem to see if we're running with the SF cgi file layout
cwd = os.path.dirname(request.stack()[-1])
path = os.path.join(cwd, 'dump.spy')
if os.path.exists(path):
sf = False
dump = '/dump.spy'
else:
sf = True
dump = '/cgi-bin/dump.spy'
# the request stack tracks Spyce code contexts: each time a new context loads,
# its filename is pushed onto the stack. [0] is the original page requested;
# [-1] is the page currently being processed (here, it would be the default
# site template).
page_source = urllib.urlencode([('path', request.stack()[0])])
]]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>[[= child.title ]]</title>
<style type="text/css">
#spycelogo {
float: right
}
#footer {
clear:both
}
#footer hr {
margin-top: 10px;
}
#footer ul {
list-style-type: none
}
fieldset {
float: left;
}
.simpleform input {
float: left;
left: 20 em;
display: block;
}
.simpleform textarea {
float: left;
left: 20 em;
display: block;
}
.simpleform label {
float: left;
width: 10em;
display: block;
clear: both;
font-weight: bold;
}
.radio label {
display: block;
font-size: 18px;
}
.radio input {
float: left;
margin-right: 1em;
}
.validationerror {
background-color: #44eeff;
}
.validationerror dt {
font-weight: bold;
margin-left: 1em;
margin-top: 0.5em;
}
.validationerror dd {
margin-left: 1em;
margin-bottom: 0.5em;
}
</style>
</head>
<body>
<h1>[[= child.title ]]</h1>
<hr>
[[= child._body ]]
<div id="footer">
<div> </div> [[-- force hr margin to take effect --]]
<hr>
<img id="spycelogo" alt="Spyce logo" src="/spyce2.png">
<ul>
<li><a href="[[= dump ]]?[[= page_source ]]">Source for this page</a></li>
<li>
<ul>
[[ for mod, path in L:{ ]]
<li><a href="[[= dump ]]?[[= urllib.urlencode([('path', path)]) ]]">Source for [[= mod ]]</a></li>
[[ } ]]
</ul>
</li>
[[ if not sf:{ ]]
<li><a href="[[= '/'.join(request.uri().split('/')[:-1]) or '/' ]]">Directory listing</a></li>
[[ } ]]
</ul>
</div>
</body>
</html>