On Wed, 2006-06-14 at 09:59 +0200, Thierry FLORAC wrote:
On Tue, 2006-06-13 at 08:28 +0200, Philipp von Weitershausen wrote:
> As said above, 'result' will be security proxied. Security proxies for
> lists only allow methods that don't change the lists. result.sort()
> would change it. Hence it's forbidden.
> An easy workaround is to use sorted():
>   result = IGalleryFolder(self.context).getImages()
>   return sorted(result, cmp=...)
> Note that using 'cmp' is very slow. It's much faster to use 'key':
>   result = IGalleryFolder(self.context).getImages()
>   return sorted(result, key=lambda x: IGalleryPhoto(x).name)

Tried this, but it doesn't work because of another ForbiddenAttribute
error :

  File ".../gallery/browser/folder.py", line 39, in getImages
    return sorted(result, key=lambda x: IGalleryPhoto(x).name)
  File ".../gallery/browser/folder.py", line 39, in <lambda>
    return sorted(result, key=lambda x: IGalleryPhoto(x).name)
ForbiddenAttribute: ('name', <gallery.photo.GalleryPhoto object at

As said before, 'IGalleryPhoto' (implemented by GalleryPhoto) is
provided in the "allowed_interface" attribute of my ZCML's view page

Oops !!
Sorry, just did a mistake : I didn't notice for this last example that "name" attribute isn't defined into IGalleryPhoto interface.
Of course, it just works fine when using a IGalleryFolder attribute...

Sorry again for the previous post !!


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

Reply via email to