AW: [Zope3-dev] Release for Views As Adapters

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Sep 28 08:50:01 EDT 2004


On Monday 27 September 2004 18:55, dev at projekt01.ch wrote:
> > These particular changes are no cause for a new release.
>
> We use some removed concepts like:
>
>     _context.action(
>         discriminator = ('view', for_, name, IBrowserRequest, layer),
>         callable = handler,
>         args = (zapi.servicenames.Presentation, 'provideAdapter',
>                 IBrowserRequest, new_class, name, for_, Interface, layer,
>                 _context.info),
>         )
>
> Is there a way for to register this views for both version of z3?

I think writing your own directives, including defining views is fair game. 
However, I think you duplicate a lot of work this way. I would recommend that 
you simply reuse the `zope:view` handler function. This way, if I change the 
underlying framework and update `zope:view` in a backward-compatible way, you 
are automatically updated as well. BTW, I use existing directive handlers all 
the time.

So in you case you should call:

from zope.app.component.metaconfigure import view

view(_context, new_class, IBrowserRequest, name, for_, layer)

That's it!

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-dev mailing list