Skip to content

Commit

Permalink
Reverted to previous change, I think
Browse files Browse the repository at this point in the history
  • Loading branch information
duane authored and anandology committed Dec 24, 2010
1 parent 4b17be4 commit d4bc2bc
Showing 1 changed file with 52 additions and 43 deletions.
95 changes: 52 additions & 43 deletions pages/src/genshi
@@ -1,45 +1,54 @@
# 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
-----

* [genshi on gae 2010 - Genshi | Google Groups](http://groups.google.com/group/genshi/t/4f3fa1beddbd4ffc)
* [/trunk/examples/webpy – Genshi](http://genshi.edgewall.org/browser/trunk/examples/webpy?rev=332)
* [api docs (web.py)](http://webpy.org/docs/0.3/api)
<p>

<h2>code.py</h2>
<p>Put your &quot;code.py&quot; in root directory.
</p>
<pre><code># -*- 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__ == &quot;__main__&quot;:
app.run()
</code></pre>
<h2>index.html</h2>
<p>Put your &quot;index.html&quot; in &quot;template&quot; directory.
</p>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;html xmlns:py=&quot;http://genshi.edgewall.org/&quot;&gt;
&lt;body&gt;
&lt;p&gt;Hello, $name.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<h2>refer</h2>
<ul>
<li>
<a href="http://groups.google.com/group/genshi/t/4f3fa1beddbd4ffc">genshi on gae 2010 - Genshi | Google Groups</a>
</li>

<li>
<a href="http://genshi.edgewall.org/browser/trunk/examples/webpy?rev=332">/trunk/examples/webpy – Genshi</a>
</li>

<li>
<a href="http://webpy.org/docs/0.3/api">api docs (web.py)</a>
</li>
</ul>


</p>

0 comments on commit d4bc2bc

Please sign in to comment.