[Grok-dev] The grokking process
Fernando Correa Neto
fcdoth at gmail.com
Thu Oct 11 10:04:52 EDT 2007
>
> Wouldn't it be a BuffetTemplate class, or something? It should do the
> logic. The view should know nothing about templates.
Well, I was thinking about the view because in grok.View all the
namespace setup is done in the render_template method and it is
explicitly doing that calling the page template. Also, by subclassing
from megrok.buffet.View would be convenient so you continue to use the
usual way to create views.
>From the code:
def _render_template(self):
namespace = self.template.pt_getContext()
namespace['request'] = self.request
namespace['view'] = self
namespace['context'] = self.context
# XXX need to check whether we really want to put None here if missing
namespace['static'] = self.static
return self.template.pt_render(namespace)
I assume self.template.pt_render(namespace) will render a zpt and I
was not planning to get all the zpt stuff adapted so pt_render knows
exactly what engine to use.
Since it is a simple extension, I thought getting it in the view would
be easier/lazy way of doing this.
Regards,
Fernando
>
> --
> Lennart Regebro: Zope and Plone consulting.
> http://www.colliberty.com/
> +33 661 58 14 64
>
More information about the Grok-dev
mailing list