Skip to content

Latest commit

 

History

History
59 lines (47 loc) · 1.22 KB

genshi.md

File metadata and controls

59 lines (47 loc) · 1.22 KB
layout title
default
Templating with Genshi

Templating with Genshi

code.py

Put your "code.py" in root directory.

# -*- coding: utf-8 -*-

import web from web.contrib import template

render = template.render_genshi(['./templates/'])

urls = ( '/', 'index' )

class index: def GET(self): name = 'John Doe' return render.index(name=name)

app = web.application(urls, globals()) if name == "main": app.run()

index.html

Put your "index.html" in "template" directory.

<?xml version="1.0" encoding="utf-8"?>
<html xmlns:py="http://genshi.edgewall.org/">
<body>
<p>Hello, $name.</p>
</body>
</html>

refer