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

Thierry FLORAC tflorac at ulthar.net
Wed Jun 14 03:33:20 EDT 2006


On Tue, 2006-06-13 at 08:26 +0200, Marco Mariani wrote:
> 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.

"getImages()" is already defined into IPhotoFolder interface. But Philip
already sent a reply with a full and clear explanation of my problem...


> > 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.

What I just mean (but perhaps I'm wrong) is that in my use case, the
"getSortedImages()" method is only used for presentation purpose in a
specific context, a specific browser view.
I think this kind of method shouldn't have to be defined in an interface
which main goal is to define generic content handling methods...
I don't know if my explanation is clear :-(

  Thierry




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the Zope3-users mailing list