[Zope3-dev] Re: View permissions

Marius Gedminas mgedmin at b4net.lt
Tue Jan 30 12:11:33 EST 2007


On Tue, Jan 30, 2007 at 02:37:18PM +0100, Martijn Faassen wrote:
> Marius Gedminas wrote:
> [snip]
> >Also, I'd like a way to specify the adapter name in the adapter class.
> >Something like
> >
> >    from zope.interface import implements
> >    from zope.component import adapts, named
> >
> >    class MyNamedAdapter(object):
> >        adapts(IFoo)
> >        implements(IBar)
> >        named('myname')
> >
> >        def __init__(self, context):
> >            self.context
> >
> >Also I'd like to have a zope.component.Adapter class that defines
> >
> >        def __init__(self, context):
> >            self.context
> >
> >and does nothing else.  It seems to me that 95% of all adapters have an
> >__init__ like this.  It is tiring to keep repeating it.
> >
> >Also, I want a pony.  Ok, not really.
> 
> You can have your pony. In grok, there's a grok.Adapter class, which
> does the thing in init, where you can specify the name using grok.name, 

Cool!

> and which causes registration as an adapter without the need for ZCML.

I am not sure I like that.  When does the registration take effect?  On
module import?

Marius Gedminas
-- 
Which is worse: ignorance or apathy?  Who knows?  Who cares?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20070130/9dc73aed/attachment.bin


More information about the Zope3-dev mailing list