On Mar 7, 2011, at 2:27 PM, Jens Hoffrichter wrote: > Luckily, I knew that from my more recent Pylons experiences, and I knew I had > to use webhelpers.html.literal() for that. But how to get the webhelpers into > the template (I was using the default Chameleon templates here)? In the > normal Pylons Mako templates I have always h and c available, where c isn't > necessary in pyramid anymore, as I have the returned values from the view > there. After quite a bit of digging around in the pyramid (which has 0 on > that topic), and chameleon docs (which has mostly BNF as a documentation, as > far as I saw), I found out that I could use something like this inside the > template: > > <div id="main" tal:define="h import:choosecourse.helpers"> > > I added a helpers.py, where I imported all my usual webhelpers into it, and > then had literal available in the template.
There is a cookbook entry for this: http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/templates.html We're trying to get most of the 'common' things folks do in the cookbook. You might find some other common things desired in there as well. Cheers, Ben -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
