[Zope3-Users] Problems with PartialAnnotationsAdapter

Fred Drake fdrake at gmail.com
Mon Jul 25 09:47:21 EDT 2005


On 7/25/05, Florian Lindner <mailinglists at xgm.de> wrote:
> without change of my codebase my objects which use the partial annotations
> adapter are not working anymore. I use it like that:
> 
> contentitem.py:
> 
> from zope.app.dublincore import annotatableadapter
> 
> factory = annotatableadapter.partialAnnotatableAdapterFactory(["title",
> "description"])
> 
> 
> configure.zcml:
> 
>     <adapter
>         for=".interfaces.IContentItem"
>         provides="zope.app.dublincore.interfaces.IZopeDublinCore"
>         factory=".contentitem.factory"
>         trusted="True"
>         permission="zope.Public"
>         />
> 
> As soon as I try to get DC metadata (for example in a content view of the
> container) I get this traceback:
> 
> 
>   File "/home/florian/Zope3/src/zope/app/container/browser/contents.py", line
> 96, in listContentInfo
>     return self._normalListContentsInfo()
>   File "/home/florian/Zope3/src/zope/app/container/browser/contents.py", line
> 122, in _normalListContentsInfo
>     info = map(self._extractContentInfo, self.context.items())
>   File "/home/florian/Zope3/src/zope/app/container/browser/contents.py", line
> 169, in _extractContentInfo
>     info['retitleable'] = canWrite(dc, 'title')
>   File "/home/florian/Zope3/src/zope/security/checker.py", line 96, in
> canWrite
>     checker.check_setattr(obj, name)
> ForbiddenAttribute: ('title',
> <zope.app.dublincore.annotatableadapter.ZDCPartialAnnotatableAdapter object
> at 0xb2ecdacc>)
> 
> 
> I'm logged in a zope.Manager, the adapter is trusted and has public access.
> 
> What is wrong with my permissions?

You need to make the title attribute of the new adapter writable.  Use
something like:

  <class class=".contentitem.factory">
    <require
        permission="zope.View"
        interface="zope.app.dublincore.interfaces.IZopeDublinCore"
        />
    <require
        permission="zope.ManageContent"
        set_attributes="created modified title"
        />
  </class>


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>
Zope Corporation


More information about the Zope3-users mailing list