[Zope-CMF] LazyFilter and Effective Dates

John Morton jwm@plain.co.nz
Fri, 28 Jun 2002 13:21:19 +1200


On Fri, 28 Jun 2002 09:21, David (Hamish) Harvey wrote:
> --On Thursday, June 27, 2002 22:35:42 +1200 John Morton <jwm@plain.co.nz>
>
> wrote:
> > On Mon, 10 Jun 2002 11:13, seb bacon wrote:
> >
> > [Discussing Carl Rendell's script to impliment effective date filtering
> > in  folders]
> >
> >> Both if you have time :)  Personally, I can't think of any circumstances
> >> where you wouldn't want this to be the default behaviour of
> >> objectValues.  I'd even suggest putting it into the CMF, but it may
> >> break things for existing applications (though again, I can't imagine
> >> how..?)
> >
> > I noticed that CMFEvents use the effectiveDate and expirationDate to make
> > the  beginning and end of an event, which is an entirely different
> > semantics from  the intended publishing ones, so putting a date filter in
> > folders would end  up mildly breaking that product.
>
> Reading this caused me to have another look at Event.py, as I was puzzled
> by this apparent anomaly before. If it were the case you could argue that
> Event mildly breaks everything else :-) I thought it was, too, but I've
> just had another look at the source, and I'm not sure it is - I think it's
> a funny bit of parameter naming.

I had another look at a catalog record for an event, and the start and end 
dates are acutally called 'start' and 'end', so I must have been confused by 
the plethora of date components in the source - though the one I've been 
playing with at home is the latest CVS, while the one I have handy is 1.2, so 
I'm not 100% certain. But I'm probably wrong :-)

> The two issues are orthogonal: you can have an item which is published, but
> not effective yet (or no longer effective). If you need to actually change 
> the workflow state as the days go by a)  you'd need to keep checking 
> everything and b) you'd need to introduce a new workflow state to mean
> "published but not visible".

You could treat them as being orthogonal, but there are a lot of advantages
to pushing the effective/expired date handling into a workflow, in that you 
can easily specify the access policy and other behaviour of your published 
but not effective states.

Here's a workflow scenario using effective and expiration dates that I find 
appealing:

 - The content goes around the usual review process until a reviewer decides 
 that the item is ready and 'publishes' it. 

 - This transition goes to a 'pre-publish' state which has three automatic 
 transitions with mutually exclusive guards on the effective and expiration 
 dates that automatically send the content into one of three different states.

 - In the 'not_yet_effective' state, the content is viewable by the owner and
 reviewers, and perhaps some larger audience.

 - In the 'published' state, the content is viewable by the usual audience.

 - In the 'expired' state you could set the viewable behaviour to the same as 
 the 'not_yet_effective' state, but I'd prefer to have the content display a
 warning notice that the content has expired, and create a worklist of
 expired content in need of updating based on this state.

The trick is to get the transition behaviour between these states working 
transparently, with as little overhead as possible, and as little 
impelmentation hassles as possible. I'm not certain how to do this, ATM, but 
I'm inclined to try wrapping a method of the content in question that get's 
frequently called on object access as a WorkflowMethod.

John