[Zope3-Users] New annotations factory problems

Ron Bickers rbickers-list-zope3 at logicetc.com
Wed May 24 16:51:04 EDT 2006


On Wed May 24 2006 16:42, Tom Dossis wrote:

> >   File "/usr/lib/zope-3.3.0_beta1/lib/python/zope/security/adapter.py",
> > line 84, in __call__
> >     adapter = self.factory(*args)
> > TypeError: __init__() takes exactly 1 argument (2 given)
>
> I haven't been following this thread, however from the error message it
> appears your adapter is missing the context (adaptee)...
>
>       def __init__(self, context):
>          # context is the IItem object to be adapted.

The README says the following:

"Note that the annotation implementation does not expect any arguments
to its `__init__`. Otherwise it's basically an adapter."

And the example is defined as follows:

class Bar(Persistent):
    interface.implements(IBar)
    component.adapts(IFoo)
    def __init__(self):
        self.a = 1
        self.b = 2

That's why I didn't think the adapter directive would do the right thing, but 
all of this (Zope 3) is pretty new to me, so what do I know.

-- 
Ron


More information about the Zope3-users mailing list