X-Git-Url: https://svn.cri.ensmp.fr/git/Portfolio.git/blobdiff_plain/2d47c9c3dc8e8265381e167514626f854a2a6f2b..30ba3a527054cc5c4c188b1049ef68e8ac0c69dd:/photo.py diff --git a/photo.py b/photo.py index e7a10a1..c0c92c6 100755 --- a/photo.py +++ b/photo.py @@ -21,9 +21,9 @@ from Products.CMFCore.permissions import View, AccessContentsInformation, \ from permissions import ViewRawImage from zope.component.factory import Factory from zope.interface import implements -from webdav.WriteLockInterface import WriteLockInterface as z2IWriteLock +from webdav.interfaces import IWriteLock from Products.CMFCore.interfaces import IContentish -from Products.CMFCore.interfaces.Contentish import Contentish as z2IContentish +from Products.CMFCore.interfaces import IDynamicType from Products.CMFCore.DynamicType import DynamicType from Products.CMFCore.CMFCatalogAware import CMFCatalogAware @@ -37,8 +37,7 @@ from interfaces import IPhoto class Photo(DynamicType, CMFCatalogAware, BasePhoto, DefaultDublinCoreImpl) : """ Photo CMF aware """ - implements(IPhoto, IContentish) - __implements__ = (z2IContentish, z2IWriteLock, DynamicType.__implements__) + implements(IPhoto, IContentish, IWriteLock, IDynamicType) meta_type = BasePhoto.meta_type manage_options = BasePhoto.manage_options @@ -48,6 +47,7 @@ class Photo(DynamicType, CMFCatalogAware, BasePhoto, DefaultDublinCoreImpl) : security.declareProtected(ViewRawImage, 'getJpegImage') def __init__(self, id, title='', file='', content_type='', precondition='', **kw) : + DefaultDublinCoreImpl.__init__(self, title=title) BasePhoto.__init__(self, id, title, file, content_type=content_type, precondition=precondition, **kw) self.id = id self.title = title @@ -58,7 +58,10 @@ class Photo(DynamicType, CMFCatalogAware, BasePhoto, DefaultDublinCoreImpl) : def update_data(self, data, content_type=None) : BasePhoto.update_data(self, data, content_type=content_type) - self.reindexObject() + # update_data can be invoked during construction + # in this case, reindexObject put a parasite catalag entry. + if self.getParentNode() : + self.reindexObject() def _getAfterResizingHooks(self) : @@ -190,14 +193,6 @@ class Photo(DynamicType, CMFCatalogAware, BasePhoto, DefaultDublinCoreImpl) : return getattr(self, '_hiddenForAnon', False) -# security.declareProtected(AccessContentsInformation, 'position') -# def position(self): -# " returns position of self in parent container " -# parent = self.getParentNode() -# position = parent.getObjectPosition(self.getId()) -# return position - - # # SimpleItem interface #