[Web-SIG] My original template API proposal

Kevin Dangoor dangoor at gmail.com
Mon Feb 6 20:50:43 CET 2006


>From your original spec:
     def __init__(extra_vars_func=None, options=None):
         """
 [Is ``extra_vars_func`` necessary?  Couldn't it be handled by
         a wrapper around ``render``?]

I think you're right. I don't see any need for extra_vars_func. I
think extra_vars_func was a side effect of refactoring the template
plugins to not be TurboGears-specific in any way. But, TurboGears can
do the equivalent from the place where it calls render().


On 2/5/06, Ian Bicking <ianb at colorstudy.com> wrote:
>       def render(template_instance, vars, wsgi_environ=None,
>                  set_header_callback=None, **kwargs):

I'm not keen on the wsgi_environ and set_header_callback options,
because I don't perceive a true need for *this* API to be tied to the
web. Of course, you need these if the template itself is going to set
any of the headers, but there is some added complexity that results.
TurboGears skirts this by having the Python code outside of the
template decide what content-type (and other headers) are appropriate.

Since these are optional, I'm not strongly against them, but they just
feel like they add a bit of complexity to an API that is dealing with
a simple problem.

Kevin


More information about the Web-SIG mailing list