Jonathan Vanasco wrote:
> well a few things i'd suggest from previous exploits in other
> languages ( btw, have you looked into pylons.templating ? )
> 
> - have render take a format argument to override
> - instead of pulling off the config, why not just read the file
> extension ?  pretty much every templating engine has claimed their own
> extension, and stopped using .tmpl or .html ; the only one i can think
> of that doesn't follow that mentality is tal, which has multiple
> render implementations.

Genshi tends to use .html, I think.  It's just too ambiguous.

> - and from personal preference, i'd  rename render to render__mako
> render__genshi .  i'd use two underscores, so one underscore is
> available for non engine defs
> 
> so...
> 
> render('file.mako')
> 
> would realize its a mako file by noticing the .mako
> if i wanted to override, i could do
> 
> render('file.mako', engine=genshi)
> or
> global_reder_override('genshi')
> render('file.mako')

Right now you could define this in an ad hoc way with:

def render(*args, **kw):
     if 'engine' in kw:
         engine = kw.pop('engine')
     else:
         engine = 'mako'
     return renderers[engine](*args, **kw)

renderers = dict(mako=render_mako, genshi=render_genshi)

It doesn't seem like that common of a need... this renderer could itself 
be provided too if it is a common desire (maybe as a class with 
renderers as an instance variable).

-- 
Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org

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