I seem to be getting an error, I'm importing like this: import applications.myapp.modules.Genshi4web2py as Genshi4web2py response.postprocessing.append(lambda x: Genshi4web2py.render(x, request, response))
but i get this: http://paste.pocoo.org/show/93469/ On Dec 1, 11:23 am, Timothy Farrell <[EMAIL PROTECTED]> wrote: > Also note that your Genshi templates (views) must be valid XML. If they > aren't Genshi will raise an exception. > There's a URL in the PDF of Genshi's Documentation website. It's ok, but > could use some attention. Feel free to ask me questions. > -tim > Timothy Farrell wrote:The article in Alter-Ego shows how to setup your > controller to default to Genshi templates. But if it fails, it will > fall-back to normal web2py templates. > Basically your init/controllers/default.py controller should look like > this:response.postprocessing.append(lambda x: Genshi4web2py.render(x, > request, response)) def index(): numbers = range(0,10) return > dict(text="Welcome to Genshi4web2py", nums = numbers)The corresponding view > (init/views/default/index.html) could look like:<html > xmlns:py="http://genshi.edgewall.org/"xmlns="http://www.w3.org/1999/xhtml"xmlns:xi="http://www.w3.org/2001/XInclude"> > <head> > <title>Genshi4web2py Demo</title> > </head> > <body> > <h1>${text}</h1> > <ol> > <li py:for="n in nums">This is number ${n}<li> > </ol> > </body> > </html> > As far as making Genshi templates, see the attached cheatsheet. I made this > for my co-worker. It should give you a basic primer. Before you use > XInclude too much, note that Genshi makes full use of XSLT and you can use > one included template to completely transform another. I use this method for > including my default header but it is not necessary by any means. If the > XSLT part confuses you, ignore it, you don't need it to understand use Genshi. > Does that help? > -tim > billf wrote:What is the best link for a quick intro of how to use genshi > templates with web2py? I don't mean install/configure but examples of actual > controllers/templates/outputs. On Dec 1, 4:53 pm, Timothy Farrell<[EMAIL > PROTECTED]>wrote:Massimo has posted a more recent Genshi4web2py.py module in > AlterEgo for me. If you use (want to use) Genshi with web2py, you can get it > from:http://mdp.cti.depaul.edu/AlterEgo/default/show/162This new version adds > cache support (for a large speed boost) and full Genshi rendering options in > a configurable manner. It should be backward compatible with the old > version. Let me know if you run into anything.-- Timothy Farrell<[EMAIL > PROTECTED]>Computer Guy Statewide General Insurance Agency (www.swgen.com)-- > Timothy Farrell<[EMAIL PROTECTED]>Computer Guy Statewide General Insurance > Agency (www.swgen.com)-- Timothy Farrell<[EMAIL PROTECTED]>Computer Guy > Statewide General Insurance Agency (www.swgen.com) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---