[Grok-dev] Re: first thoughts on "regebro-guido-templates"

Lennart Regebro regebro at gmail.com
Tue Oct 30 09:53:30 EDT 2007


On 10/30/07, Martijn Faassen <faassen at startifact.com> wrote:
> True, I hadn't considered that. What about introducing a new method
> that does the combination, so that there's no requirement for the
> person writing the plugin anywhere?

So you mean something like this:

class MyTemplate(object):

    def namespace(self, view):
        return {'request': view.request,
                     'view': view}

    def getNamespace(self, view):
        return self.namespace(view).update(view.namespace())

    def render(self, view):
        return  self._template.render(**self.getNamespace(view))

Where getNamespace would be the new method you talk about (and
normally defined only on the baseclass)?

-- 
Lennart Regebro: Zope and Plone consulting.
http://www.colliberty.com/
+33 661 58 14 64


More information about the Grok-dev mailing list