Mercurial > genshi > mirror
changeset 627:3ed77fbfafa8 trunk
GenshiTutorial: minor tweaks to sync with Wiki page.
author | cmlenz |
---|---|
date | Fri, 31 Aug 2007 23:13:27 +0000 |
parents | 1fc90c02e2d8 |
children | 9822dfff0fd5 |
files | examples/tutorial/geddit/controller.py examples/tutorial/geddit/templates/index.html examples/tutorial/geddit/templates/layout.html |
diffstat | 3 files changed, 11 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/examples/tutorial/geddit/controller.py +++ b/examples/tutorial/geddit/controller.py @@ -38,14 +38,6 @@ return template.render(links=links) @cherrypy.expose - @template.output('info.html') - def info(self, id): - link = self.data.get(id) - if not link: - raise cherrypy.NotFound() - return template.render(link=link) - - @cherrypy.expose @template.output('submit.html') def submit(self, cancel=False, **data): if cherrypy.request.method == 'POST': @@ -65,6 +57,14 @@ return template.render(errors=errors) | HTMLFormFiller(data=data) @cherrypy.expose + @template.output('info.html') + def info(self, id): + link = self.data.get(id) + if not link: + raise cherrypy.NotFound() + return template.render(link=link) + + @cherrypy.expose @template.output('comment.html') def comment(self, id, cancel=False, **data): link = self.data.get(id)
--- a/examples/tutorial/geddit/templates/index.html +++ b/examples/tutorial/geddit/templates/index.html @@ -5,24 +5,17 @@ <xi:include href="layout.html" /> <head> <title>News</title> - <link rel="alternate" type="application/atom+xml" title="Geddit" - href="${url('/feed/')}" /> </head> <body> <h1>News</h1> - <ol py:if="links" class="links"> + <ol py:if="links"> <li py:for="link in links"> <a href="${link.url}">${link.title}</a> posted by ${link.username} at ${link.time.strftime('%x %X')} - <div class="info"> - <a href="${url('/info/%s/' % link.id)}"> - ${len(link.comments)} comments - </a> - </div> </li> </ol> - <p><a class="action" href="${url('/submit/')}">Submit new link</a></p> + <p><a class="action" href="/submit/">Submit new link</a></p> </body> </html>
--- a/examples/tutorial/geddit/templates/layout.html +++ b/examples/tutorial/geddit/templates/layout.html @@ -5,7 +5,7 @@ <py:match path="head" once="true"> <head py:attrs="select('@*')"> <title py:with="title = list(select('title/text()'))"> - geddit<py:if test="title">: ${title}</py:if> + Geddit<py:if test="title">: ${title}</py:if> </title> <link rel="stylesheet" href="${url('/media/layout.css')}" type="text/css" /> <script type="text/javascript" src="${url('/media/jquery.js')}"></script>