We're thinking about dropping the buffet plugin from TG2. Pylons is
definitely in process of depricating it in 0.9.7.
The reason behind this is mainly that buffet restricts the ability of
users to use the more advanced features of Mako and Genshi, and
requires a huge amount of code to do something really simple.
Pylons has created two functons render_genshi and render_mako which
provide default render mechanisms for genshi and mako. They ask
users to return a string and call render_mako(**whatever_args) in
their controller methods. This will of course work in TG2 since we
support returning a string already, but it makes stacked expose kind
of useless. So, my proposal is that we create a default render
method that takes an engine as an optional parameter. We would then
define a dictionary of render functions by engine in the config, so
the render method would just do something like:
def render(namespace, options, engine, ...):
if not engine:
engine = get_default_engine()
if not options:
options = get_default_options()
if engine in renderers.keys():
return renderers[engine](template_name, template_options,
template_params)
else:
raise RenderFunctionNotFound()
Of course, this will be slightly complicated by the need to support
caching, but I think that's totally worth it ;)
The main benifit of this theory is that it would allow us to keep the
current expose style, and allow users to create non-default renderers
just by creating a new render function and setting it up in the
config. It would also allow users to have several renderers
installed -- but not imported or used in a particular project. Another
feature request I've seen that this would make easy is the ability to
have different genshi renderers avalilable (with different names of
course) with different rendering options.
Alternatively we could also add the buffet interface into TG2 and use
that, but I tend to think that the Pylons decision to drop buffet for
the new 5 line render functions makes sense.
Any thoughts?
--
Mark Ramm-Christensen
email: mark at compoundthinking dot com
blog: www.compoundthinking.com/blog
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" 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/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---