[Zope3-Users] New annotations factory problems
Tom Dossis
td at yoma.com.au
Wed May 24 16:42:46 EDT 2006
Ron Bickers wrote:
> On Wed May 24 2006 07:00, Martijn Faassen wrote:
>
> An IItem interface and a class Item implementation that's attribute
> annotatable.
>
> The annotation interface and class are as follows:
>
> class IItemMiscInfo(Interface):
>
> inStock = Bool(
> title=u"In Stock",
> description=u"Is item in stock?",
> default=True)
>
> class ItemMiscInfo(Persistent):
> implements(IItemMiscInfo)
> adapts(IItem)
>
> def __init__(self):
> self.inStock = True
>
> What am I supposed to use in the adapter directive as the factory? If I
> put ".item.ItemMiscInfo", I get "TypeError: Missing 'provides' attribute"
> when starting Zope. If I add provides=".interfaces.IItemMiscInfo", I get
> the following error when trying to access the editform:
>
> 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.
More information about the Zope3-users
mailing list