[Zope3-Users] Question about "ForbiddenAttribute"...

Marco Mariani marco at sferacarta.com
Tue Jun 13 02:26:46 EDT 2006


Thierry FLORAC wrote:
>   <page
>     name="images.html"
>     for=".interfaces.IGalleryFolder"
>     allowed_interface=".interfaces.IGalleryPhoto"
>     template="folder_images.pt"
>     permission="zope.View"
>     class=".folder.FolderInfo"
>     menu="zmi_views" title="Images" />
>
> But when trying to display the view, a ForbiddenAttribute exception is
> raised :
>   File ".../browser/folder.py", line 39, in getImages
>     result.sort (lambda x,y:
>                  cmp(IGalleryPhoto(x).name,IGalleryPhoto(y).name))
>   ForbiddenAttribute:('sort',[<GalleryPhoto object at 0xa5b378ac>,...] 
>
> So the forbidden attribute seems to be the "sort" method of the
> resulting array, which of course isn't part of any of my interfaces.
>
> In such a case, I solved the problem by moving the "getSortedImages" to
> the folder interface and content class.
>   
You have to define an empty getImages method on the interface.
> But that may not always be possible, so how can I get access to such
> methods ??
>   
Why should it not be possible? After all, you defined the FolderInfo
view for the IGalleryFolder _Interface_, not the GalleryFolder class.



More information about the Zope3-users mailing list