[Interface-dev] module-level interface
John Lenton
jlenton at gmail.com
Thu Jun 9 12:28:02 EDT 2005
On 6/9/05, Jim Fulton <jim at zope.com> wrote:
> John Lenton wrote:
> > Well, this is what I came up with. It works for me, but I can't get
> > the testing framework to work so it's untested outside of my own use
> > case. What I've done is made it so that interfaces can contain other
> > interfaces, which is then used by verifyObject to check that the
> > object being verified contains an object that implements that
> > interface.
>
> This is different from what I thought you were asking for yesterday.
> I thought you wanted to specify an object with an attribute that could
> be called to get an object of some interface.
sorry about that.
On 6/9/05, Stephan Richter <srichter at cosmos.phy.tufts.edu> wrote:
>
> This does not look right to me. Interfaces can either have attributes or
> methods. In your case you have a special attribute that has the requirement
> to provide ``IWindow``. The right way to do it would be to write a
> custom/derived implementation of ``IAttribute``. Note that Zope 3 itself has
> solved this problem by providing an advanced schema package that allows you
> to describe much more meta-data of attributes using fields. Here an example:
>
> [ code ]
>
> Note that this is working code. You can copy the above into a doctest and it
> will work. Since it does not matter whether the implementations are class
> instances or modules, it will work for modules as well.
wow. Thanks a lot for the pointer to zope.schema, and doubly for the
sample working code. I'll look into this right away. Again, thanks!
--
John Lenton (jlenton at gmail.com) -- Random fortune:
Don't anthropomorphise computers and cars, They hate that.
More information about the Interface-dev
mailing list