On Fri, Dec 18, 2009 at 08:51, Brian Sutherland <br...@vanguardistas.net> wrote:
> I like things to fail noisily and loudly unconfigured and give good
> information about what's wrong.


>  So my preferred implementation of a
> stub "utility" function on Interface is:
>    def utility(default=None):
>        """Lookup a utility for this interface.
>        A utility is a ${long explanation of utility concept}.
>        This method behaves like ${explanation of utility method contract}.
>        """
>        raise NotImplementedError("""No Utility lookup mechanism has been 
> configured.
>            If you wish to use utility lookups on interfaces, please configure 
> a
>            package that contains this mechanism. Packages known to
>            implement this are:
>                zope.component
>            """)
> I agree that this encodes in the zope.interface package concepts from
> zope.component.

I think that is stretching the "encoding concepts" a bit too far. Yes,
we make zope.interface aware that such a thing as utility-registries
exist, but say we don't implement it. I don't think that's a problem.
The error message also gives an example of an implementation. That's
probably not a problem either.

> I feel uncomfortable about that.

I don't. :-)

Lennart Regebro: http://regebro.wordpress.com/
Python 3 Porting: http://python-incompatibility.googlecode.com/
+33 661 58 14 64
Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to