From 945dc8fead8d07513d4b0116e93072d820bd38dd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Sun, 7 Jul 2013 17:57:02 +0200 Subject: [PATCH 1/1] =?utf8?q?getUtilityByInterfaceName=20a=20cr=C3=A9?= =?utf8?q?=C3=A9=20un=20bug=20assez=20sournois=C2=A0:=20reindexObject=20es?= =?utf8?q?t=20capable=20de=20r=C3=A9cup=C3=A9rer=20le=20catalogue,=20avant?= =?utf8?q?=20l'ach=C3=A8vement=20de=20la=20construction.=20Le=20bug=20?= =?utf8?q?=C3=A9tait=20auparavant=20silencieux=20(voire=20n'existait=20pas?= =?utf8?q?)=20car=20la=20r=C3=A9cup=C3=A9ration=20du=20catalogue=20par=20C?= =?utf8?q?MFCatalogAware.reindexObject=20retournait=20None,=20et=20donc=20?= =?utf8?q?il=20n'y=20avait=20pas=20=E2=80=93=20de=20fait=20=E2=80=93=20d'i?= =?utf8?q?ndexation=20pr=C3=A9matur=C3=A9e.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- photo.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/photo.py b/photo.py index e66f8eb..c0c92c6 100755 --- a/photo.py +++ b/photo.py @@ -21,11 +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 import IDynamicType -#from Products.CMFCore.interfaces.Contentish import Contentish as z2IContentish from Products.CMFCore.DynamicType import DynamicType from Products.CMFCore.CMFCatalogAware import CMFCatalogAware @@ -40,7 +38,6 @@ class Photo(DynamicType, CMFCatalogAware, BasePhoto, DefaultDublinCoreImpl) : """ Photo CMF aware """ implements(IPhoto, IContentish, IWriteLock, IDynamicType) - #__implements__ = (z2IContentish, IWriteLock, DynamicType.__implements__) meta_type = BasePhoto.meta_type manage_options = BasePhoto.manage_options @@ -61,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) : @@ -193,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 # -- 2.20.1