import web from web.template import Template urls = ( '/(.*)', 'hello' ) tmpl = """$def with (todo) $for t in todo: $t """ class hello: def GET(self, name): t = Template(tmpl)(web.select('todo')) print t if __name__ == "__main__": web.config.db_parameters = dict(dbn="sqlite", db="test.db") web.run(urls, globals())