Mercurial > genshi > mirror
changeset 441:2755b06148b3 trunk
Fix undefined error in TurboGears example app, and some cleanup.
author | cmlenz |
---|---|
date | Wed, 11 Apr 2007 11:02:02 +0000 |
parents | 7884617bc941 |
children | 97544725bb7f |
files | examples/turbogears/genshitest/controllers.py examples/turbogears/genshitest/templates/master.html examples/turbogears/genshitest/templates/welcome.html |
diffstat | 3 files changed, 46 insertions(+), 60 deletions(-) [+] |
line wrap: on
line diff
--- a/examples/turbogears/genshitest/controllers.py +++ b/examples/turbogears/genshitest/controllers.py @@ -18,9 +18,7 @@ log.debug("Happy TurboGears Controller Responding For Duty") return dict(now=time.ctime(), widget=widgets.TextArea(name="widget_test", - default="This is a test of using " - "TurboGears widgets with " - "Genshi", + default="Lorem ipsum", rows=5, cols=40)) @expose(template="genshi-text:genshitest.templates.plain",
--- a/examples/turbogears/genshitest/templates/master.html +++ b/examples/turbogears/genshitest/templates/master.html @@ -1,43 +1,36 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" + xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:py="http://genshi.edgewall.org/" - xmlns:xi="http://www.w3.org/2001/XInclude" py:strip=""> - -<xi:include href="sitetemplate.html"><xi:fallback/></xi:include> + <xi:include href="sitetemplate.html"><xi:fallback/></xi:include> -<head py:match="head" py:attrs="select('@*')"> - <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/> + <head py:match="head" py:attrs="select('@*')"> + <meta content="text/html; charset=UTF-8" http-equiv="content-type" + py:replace="''" /> <title py:replace="''">Your title goes here</title> - <meta py:replace="select('*')"/> + <meta py:replace="select('*')" /> <style type="text/css"> - #pageLogin - { - font-size: 10px; - font-family: verdana; - text-align: right; - } + #pageLogin { font-size: 10px; font-family: verdana; text-align: right; } </style> -</head> + </head> -<body py:match="body" py:attrs="select('@*')"> - <div py:if="tg.config('identity.on',False) and not logging_in" - id="pageLogin" - py:choose=""> - <span py:when="tg.identity.anonymous"> - <a href="/login">Login</a> - </span> - <span py:otherwise=""> - Welcome ${tg.identity.user.display_name}. - <a href="/logout">Logout</a> - </span> + <body py:match="body" py:attrs="select('@*')"> + <div id="pageLogin" + py:if="tg.config('identity.on', False) and not value_of('logging_in')" + py:choose=""> + <span py:when="tg.identity.anonymous"> + <a href="/login">Login</a> + </span> + <span py:otherwise=""> + Welcome ${tg.identity.user.display_name}. + <a href="/logout">Logout</a> + </span> </div> - <div py:if="tg_flash" class="flash" py:content="tg_flash"></div> - - <div py:replace="select('*|text()')"/> - + <div py:replace="select('*|text()')" /> <p align="center"><img src="/static/images/tg_under_the_hood.png" alt="TurboGears under the hood"/></p> -</body> + </body> </html>
--- a/examples/turbogears/genshitest/templates/welcome.html +++ b/examples/turbogears/genshitest/templates/welcome.html @@ -1,39 +1,34 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://genshi.edgewall.org/" - xmlns:xi="http://www.w3.org/2001/XInclude"> -<xi:include href="master.html" /> + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:py="http://genshi.edgewall.org/"> + <xi:include href="master.html" /> -<head> + <head> <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/> <title>Welcome to TurboGears</title> -</head> - -<body> - <p>Congratulations, your TurboGears application is running as of <span py:replace="now">now</span>.</p> - - <h2>Are you ready to Gear Up?</h2> - - <p>Take the following steps to dive right in:</p> + </head> - <ol> - <li>Edit your project's model.py to create SQLObjects representing the data you're working with</li> - <li>Edit your dev.cfg file to point to the database you'll be using</li> - <li>Run "<code>tg-admin sql create</code>" to create the tables in the database</li> - <li>Edit controllers.py to add the functionality to your webapp</li> - <li>Change the master.kid template to have the headers and footers for your application.</li> - <li>Change welcome.kid (this template) or create a new one to display your data</li> - <li>Repeat steps 4-6 until done.</li> - <li><b>Profit!</b></li> - </ol> + <body> + <p>Congratulations, your TurboGears application is running as of + <span py:replace="now">now</span>.</p> - <p>If you haven't already, you might check out some of the <a href="http://www.turbogears.org/docs/" >documentation</a>.</p> + <h2>Using Genshi in TurboGears</h2> - <p>Thanks for using TurboGears! See you on the <a href="http://groups.google.com/group/turbogears" >mailing list</a> and the "turbogears" channel on irc.freenode.org!</p> + <p> + Please see the online + <a href="http://genshi.edgewall.org/wiki/Documentation">documentation</a> + for general information on Genshi. + </p> + <p>Here's an example for using a TurboGears widget in a Genshi template:</p> ${ET(widget.display())} - <p>Here's a <a href="plain">link</a> to the output of a plain-text template.</p> + <p> + And here's a <a href="plain">link</a> to the output of a plain-text + template. + </p> -</body> + </body> </html>