On Thu, Jun 26, 2008 at 7:17 PM, Nick <[EMAIL PROTECTED]> wrote:
>
> So, I'm sure this is just downright silly and has been done before,
> but I'm a relative newbie to python and especially pylons (working
> with it for 3 days now), so even the small accomplishments make me
> very happy.  On the off chance that nobody's done anything like this
> before, I thought I'd post this to help anyone down the line.
>
> I'm intrigued by both Genshi and Mako as templating engines and just
> can't decide which one I like more.  I really like the xml-ness of
> Genshi, but at the same time, I like the easiness of Mako...  Thus, I
> wanted to find some way to switch between the two rendering engines
> simply by changing the template_engine in environment.py...  But when
> I did that, I also had to change the url of each file loaded, and
> genshi still wasn't serving as content_type = "xhtml" like I
> wanted...  Switching between engines is simply a pain.  So, I added a
> render engine dispatcher to /lib/base.py (in the BaseController
> class):

I had kind of the same idea when i started, that you could have two
parallel sets of templates and switch engines by merely changing the
default engine.  But the template engines are just too different for
that; some have a different template URL, others need different
variables, etc.  Then I went with calling the engine explicitly in the
controller:  render("genshi", "/foo.html").  That worked better.  I
ended up getting fed up with Genshi, not sure how to set up a site
template and pass the page title and breadcrumbs to it, the XML syntax
getting in the way, missing flexibility or a syntax I couldn't get my
head around, so I went to Mako full time.

In Pylons 0.9.7-dev, Buffet has been replaced by simple render_mako()
and render_genshi() functions, which   you call directly from the
controllers.  So I wouldn't spend a lot of work tweaking Buffet.  But
if your self.render() method is working, there's no reason to switch
from it.

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to