[Zope-CMF] Re: Effective use of effective_date and expiration_date

Tres Seaver tseaver at palladion.com
Mon Aug 28 21:28:48 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jens Vagelpohl wrote:
> 
> On 29 Aug 2006, at 01:36, Dmitry S. Makovey wrote:
> 
>>>
>>> Sorry for crossposting it from Plone mailing list but I need some
>>> pointers ASAP :(
>>>
>>> I'm sure this topic came up before but I'm hard pressed right now and
>>> google returns nothing useful.
>>>
>>> What I need is to activate transitions on effective_date and
>>> expiration_date. Quick "screw-around" with automatic/WorkflowMethod
>>> transitions yeilded zero positive results (unless I'm doing it
>>> wrong). Anybody seen anything like this done before?

"Automatic" transitions can't fire by themselves in a request driven
world:  instead, they fire after any "user-driven" transition, assuming
that their guards pass, and keep firing until they "quiesce".

> Not sure what you mean by "transitions", the CMF (and I'm sure it's the
> same in Plone) use the effective/expiration dates to filter out items
> that are not effective yet or have expired when doing catalog searches.
> Since most views do rely on catalog searches this suppresses items quite
> effectively.

Yep -- this is how the "typical" site uses those dates.  However, some
folks want actual workflow transitions to happen ASAP after each date
passes.  In that case, you need to write a periodic task which searches
for objects which are in the "between" state (e.g., their expiration
date has passed but they are still "active"), and cause the workflow
tool to "tickle" the transition machinery.  E.g., as a Python Script::

  # untested
  for brain in context.portal_catalog.searchResults(
                        review_state="published",
                        expiration_date={'query': ZopeTime(),
                                         'operator': 'max'}):
      obj = brain.getObject()
      wf_tool.doActionFor(ob, 'expire')



Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE85gq+gerLs4ltQ4RAmGSAJ9c54Jdj2JmODD49vJM7YJBfas2zwCfSkCT
fRm0QyhWROSVwIKamV6v3Ik=
=eFba
-----END PGP SIGNATURE-----



More information about the Zope-CMF mailing list