Ejemplo n.º 1
0
    def __setitem__(self, name, item):
        super(PhotoAlbum, self).__setitem__(name, item)

        if IPhoto.providedBy(item):
            self.photos.insert(name)
        elif IPhotoAlbum.providedBy(item):
            self.albums.insert(name)
Ejemplo n.º 2
0
def photoRemoved(photo, event):
    parent = event.oldParent
    while parent is not None:
        if IPhotoAlbum.providedBy(parent):
            removeSecurityProxy(parent).__dict__['totalPhotos'].change(-1)
        else:
            break
        parent = getattr(parent, '__parent__', None)