Re: Interfaces vs ZCA concepts

Martijn Faassen <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
Hey,

Tres Seaver wrote:
[snip]
> - -1 to any docstring / exception method which points outside the
> zope.itnerface package.  There is a perfectly reasonable "default"
> implementation anyway (in the absence of any hooks):

You're against a docstring talking about zope.component overriding 
these? Seriously? I mean, just mentioning zope.component in the 
docstring is taboo?

Now as to the default behavior of these methods:

> - - IFoo.adapt(context) raises LookupError, unless the context
>   provides IFoo, in which case it returns context.
> 
> - - IFoo.adapt(context, default=default) returns default unless context
>   provides IFoo, in which case it returns context.
> 
> - - IFoo.utility() raises LookupError.
> 
> - - IFoo.utility(default=default) returns default

Basically the default behavior of the methods would be like nothing ever 
got registered. That looks reasonable to me, +1.

> I would much rather keep a "hook registration" API in the interface
> class for these methods than obscure their origin semantics via a monkey
> patch.

Okay, I guess that does make sense.

Regards,

Martijn

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.