[Zope3-dev] Need help with JobBoardEx
Guido van Rossum
guido@python.org
Tue, 06 Aug 2002 16:08:12 -0400
I haven't made much progress with this problem, except to rule out a
bunch of things.
The JobBoard code itself still works; however the configuration parser
doesn't want to believe that the JobBoard class is a factory. Here's
the ZCML (slightly different from CVS, but it doesn't make a
difference):
<content class=".JobList.">
<factory
id="JobList"
permission="Zope.ManageContent"
title="Job List"
description="A Job List" />
<allow interface=".IJobList." />
<implements interface="Zope.App.OFS.Container.IContainer.IItemContainer" />
</content>
It appears that the <factory> directive invokes the provideFactory()
method of the GlobalFactoryService class (in
Zope/ComponentArchitecture/GlobalFactoryService.py):
def provideFactory(self, name, factory):
"""See IGlobalFactoryService interface"""
verifyObject(IFactory, factory)
self.__factories[name] = factory
If I comment out the call to verifyObject() everything works as
expected. Adding some print statements (and a call to
trustedRemoveSecurityProxy) show that the factory object that causes
the failure is a security proxy for a ClassFactory instance whose
_class attribute is the JobList class.
But here's the mystery: look at the way the class
Zope.App.OFS.Content.Image.Image.Image is configured; it's very similar:
<content class=".Image.">
<factory
id="Image"
permission="Zope.ManageContent"
title="Image"
description="An Image" />
<require
permission="Zope.View"
interface="Zope.App.OFS.Content.File.IFile.IReadFile" />
<require
permission="Zope.View"
interface=".Image.IImage" />
<require
permission="Zope.ManageContent"
interface="Zope.App.OFS.Content.File.IFile.IWriteFile" />
</content>
The <factory> statement is almost identical. I tried removing the
other differences in the <content> directive; these don't seem to make
a difference.
Looking in the Image class in the Image module, I see no further
clues. I checked all the base classes and interfaces, and none of
them asserts the IFactory interface (or implements __call__); and even
if I add
__class_implements__ = IFactory
to the JobList class, I still get the same error.
HEEEEEEEEEEEEEEEEEEEEEEEEEEELP!!!!!
--Guido van Rossum (home page: http://www.python.org/~guido/)