[Zope3-Users] New annotations factory problems
Ron Bickers
rbickers-list-zope3 at logicetc.com
Wed May 24 16:32:43 EDT 2006
On Wed May 24 2006 07:00, Martijn Faassen wrote:
> Ron Bickers wrote:
> > I was trying to implement the new annotations factory in
> > zope/annotation/README.txt but I'm getting a ForbiddenAttribute
> > __annotations__ error when I try to view an editform for the
> > annotations.
> >
> > Before, I had configured a trusted adapter, but since (I think) an
> > adapter directive is not needed for this, I don't know how to make it
> > trusted or otherwise fix the problem.
> >
> > Any ideas?
>
> These annotations still get registered using the adapter statement:
>
> <adapter
> factory=".my.annotationfactory"
> trusted="true"
> />
I tried this, but I'm still having trouble. Perhaps I'm missing something
simple. I have the following:
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)
The README says to do this:
zope.component.provideAdapter(zope.annotation.factory(Item))
I can do that in a debug session and it works as expected, I just can't
figure out the rest.
What am I missing?
--
Ron
More information about the Zope3-users
mailing list