Re: notifyModified called when object re-indexed
Roché Compaan <roche-kb4xc5yObU3kQYj/0HfcvhBnub05S5/[email protected]> Thu, 15 Jun 2006 23:09:28 +0200
| Newsgroups | gmane.comp.web.zope.plone.archetypes.devel |
|---|---|
| Message-ID | <1150405768.13129.30.camel@kwaaitjie> |
On Wed, 2006-06-14 at 21:52 +0200, Dieter Maurer wrote: > Roché Compaan wrote at 2006-6-13 17:03 +0200: > >Can somebody explain why notifyModified is called from CatalogMultiplex > >when re-indexing an object only if idxs is an empty list? > > > >Here's the relevant code: > > > > def reindexObject(self, idxs=[]): > > if idxs == []: > > if hasattr(aq_base(self), 'notifyModified'): > > self.notifyModified() > > I think it is an abuse of "reindexObject"... > But, I can report about the motivation: > > When you edit an object, you often want to change the > modification time (done by "notifyModified"). > > Because there are many "edit" method implementations, > the implementor (who introduced the hack above) tried > to avoid modifying all of them. Therefore, he looked > for a single place where to possibly change the modification time. > He came up with "reindexObject", called by all "edit" methods... > > Now, "reindexObject" is often called for specific indexes > when you do *NOT* want to change the modification time, e.g. > after a workflow change (which does not modify the object itself > but some kind of metadata only). > Therefore, the implementor decided to let "reindexObject" > call "notifyModified" when no indexes are specified (as > used by the "edit" methods) but not, if indexes are specified. > > As mentioned above, I do not like this solution. But, we may need to > live with it. You explaining it makes living with a lot more bearable ;-) -- Roché Compaan Upfront Systems http://www.upfrontsystems.co.za _______________________________________________ Archetypes-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/archetypes-devel