/usr/share/doc/python-templayer/examples/lawn5.py is in python-templayer 1.5.1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import templayer
import time
import sys
sys.stdout.write("Content-type: text/html\r\n\r\n")
reports = [
('Sunday', ["We've got a groundhog. I will have to stay alert.",
"I lost half a tomato plant to that furry guy."]),
('Monday', ["The grass grew - I saw it."]),
]
tmpl = templayer.HTMLTemplate("lawn5.html")
file_writer = tmpl.start_file()
main_layer = file_writer.open(title="Gordon's Lawn Happenings",
date=time.asctime())
for d, h in reports:
happening_list = []
for w in h:
formatted = tmpl.format('happening', what=w)
happening_list.append(formatted)
main_layer.write_layer('report', day=d, happenings=happening_list)
file_writer.close()
|