[Zope-CMF] Re: Don't always set the modification date?

yuppie y.2005- at wcm-solutions.de
Sun Feb 13 13:05:32 EST 2005


Hi Paul!


Paul Winkler wrote:
> I'm finding that there are times we want to be able to tweak
> content without updating the "modified" timestamp.  For example,
> if you fix a typo in a year-old article, or make a trivial
> visual tweak, it may be misleading to make readers think that 
> the content reflects something you would write today, and you
> might not want the content to pop up to the top of the typical
> "Recent changes" list.
> 
> I can see a way to hack around the current DublinCore implementation,
> by customizing metadata_edit_form to pass a flag like "no_timestamp"
> and then customize metadata_edit_controller like so:
> 
> ...
>     old_modtime = context.ModificationDate()
>     context.editMetadata( title=title
>                           ...
>                         )
>     if request.get('no_timestamp'):
>         context.setModificationDate(old_modtime)    
>         
> ...
> 
> But it occurred to me that I might not be the only one who wants
> this feature, in which case maybe we could modify editMetadata()
> in DublinCore.py to take an optional flag like set_modification_date=None.
> 
> Or maybe more generally, have an optional modification_date=None 
> argument, which is just passed to setModificationDate()?
> (but then if None means "now", what means "keep the old timestamp"?
> maybe we'd really want both arguments?)
> 
> Or is all this too much of an edge case to justify modifying
> CMFCore ?

Some random thoughts:

1.) Updating 'modification date' or not is policy and should be 
customizable.

2.) editMetadata() and edit() call reindexObject(). If you use 
setModificationDate() *after* editMetadata() you have to make sure the 
catalog is up to date.

3.) For historical reasons reindexObject() calls notifyModified(), not 
the other way round. So calling reindexObject() after 
setModificationDate() sets a new timestamp. Calling 
reindexObject(idxs=['modified']) preserves the timestamp and updates the 
index, but doesn't update the brain / metadata in the catalog. 
Occasionally I use this workaround:

     obj.reindexObject(idxs=['suppress_notifyModified'])

Of course that's expensive and just a hack.

4.) CMF 1.5 has the same issues with 'creators'.

5.) If CMFEvent will become reality cleaning up that mess should be easier.


Cheers,

	Yuppie



More information about the Zope-CMF mailing list