[Grok-dev] Making a custom base View class derived from grok.View?

Jeff Shell eucci.group at gmail.com
Tue Jan 1 21:51:16 EST 2008

Hi. I was spending a little bit of time this holiday playing with
Grok. I've done a lot of work with Zope 3 and was trying to integrate
some custom things I had done with grok.View. But all of the automagic
grok stuff starts yelling at me if the class isn't bound to a context,
or doesn't have a template. I don't want this class to have either of
those - I want it to be treated as an abstract base class, like
grok.View itself.

The class just looks like this:

class View(grok.View):
    """ Mixture of Grok Views with br.ez Views """

    def __init__(self, context, request):
        super(View, self).__init__(context, request)
        self.helper = self.h = html_helper_for(request)

and is in its own module, where I'd like to have some other custom
bases that my app can use that mix some of the work I've built up over
the last few years with Grok.

Is there an easy way to tell Grok that this is an abstract base View?
Do I need to make my own 'meta.py' with a subclass of
'grok.meta.ViewGrokker' that overrides the 'component_class'
attribute? If that's the trick, how do I register that?

Jeff Shell

More information about the Grok-dev mailing list