[Zope3-dev] Need help with JobBoardEx

Gary Poster gary@modernsongs.com
Tue, 6 Aug 2002 23:47:45 -0400


From: "Guido van Rossum" <guido@python.org>
To: "Gary Poster" <gary@modernsongs.com>

[apologetic disclaimer: I'm responding from my Windows box so some of these
statements are from memory]

...

> > 2) the IFactory interface apparently should not have the __call__ method
> > requirement.

...

> Are you sure?  I think this is asserting the interface on the class
> viewed as an object, not on the instances of its class.  Certainly any
> object that wants to be a factor has to be callable, and __call__ is
> the right way to ask for it.

If I were sure I would have checked it in. ;-)  Yes, we share the same
understanding of our goal, I think.  This is what my statement was based on:
in Python (pre-alpha 2.3 from last week's CVS) interactive mode I created
"class X: pass" and then asked for "X.__call__" and received an
AttributeError.  So I said what I said.  Looking at it again, I wonder if I
that was a naive approach on my part; certainly if anyone would know, you
would!  But that was my backup.

> I'm curious if the security proxies are confounding stuff.  Maybe the
> Image factory is somehow wrapped in a security proxy and the JobList
> class isn't, or the other way around.  (But how???)

I don't think that's the case here--the security proxy doesn't wrap around
anything until a request is processed, as far as I know.

> > 3) Note this interesting interactive Python output:
> >
> > >>> verifyObject(IFactory, Image)
...
> > Interface.Exceptions.DoesNotImplement: An object does not implement
> > interface <Interface Zope.ComponentArchitecture.IFactory.IFactory at
> > 4022edac>
> >
> > That is, Image in fact creates the same exception that JobList does.
> > This might imply that the built-in factories are not running through the
> > full verification process to which JobList was (correctly) submitted.
>
> No, this is *not* the same exception I get.  I get:
>
>   BrokenImplementation: An object has failed to implement interface
<Interface Zope.ComponentArchitecture.IFactory.IFactory at 404cb0cc>
>
>   The __call__ attribute was not provided.

Ah, I was not as thorough as I should have been; sorry.  In interactive
mode, though, I believe that JobList did raise the same exception.  Maybe
this is a red herring.

Perhaps more to my point, the Image class doesn't provide getInterfaces, and
yet it does not cause a BrokenImplementation or DoesNotImplement error when
loading.  I assume there is some magic somewhere for it to be accepted
during Zope's load, while JobList is not.  But the behavior of JobList
(raising an exception on load) should be the *correct * response with the
current IFactory definition, as far as I can tell.

> > In any case, if I make IFactory into a simple "class
> > IFactory(Interface): pass" statement, the JobList is on my add content
> > list, which is as far as I went.  I believe this is in fact the correct
> > resolution.  However, I'm not checking this in, because this is just my
> > take on things.
>
> That's not very different from my hack of commenting out the
> verifyObject() call.  Once the JobList is on the add list,
> everything's hunky dory (at least for me).

Very true.  I think my approach might be getting closer to the heart of the
problem, though.

Or maybe I need to do some more digging. :-)

Gary