[Zope] "Picture of the day" product

Tres Seaver tseaver@digicool.com
Wed, 17 Jan 2001 22:04:42 -0500


Timothy Wilson <wilson@visi.com> wrote:
> 
> Hey everyone,
> 
> I was looking at linux.com the today and I noticed their "Daily Photo." I
> occurred to me that that would be a fun addition to the school's page that
> I'm developing. My first thought would be to:
> 
> * inherit from Image
> * add caption, date taken, etc. properties
> * create an archive of past photos
> 
> What I'm not sure about is how to have Zope automatically display the photo
> for a day, then archive it. Would a boolean property of the ZClass work? Is
> it possible to have Zope set the property of a ZClass instance at certain
> time? Any thoughts on how this would be designed?

This kind of thing is a "query-on-metadata" application;  I would
put all these images into a single folder (maybe chunked into
subfolders by month?), mark them each with an 'effective' property
(of type 'Date'), and then select the appropriate image via a
catalog query, e.g.::

  <dtml-in "Catalog( meta_type='Image'
                   , effective=( ZopeTime().earliestTime(),
ZopeTime().latestTime() )
                   , effective_usage='range:min:max'
                   # other query parms here, including any sorting...
                   )">
  <dtml-if sequence-start>
    <dtml-var "Catalog.getobject( data_record_id_ )">
  </dtml-if>
  </dtml-in>

Or you could just have the catalog fetch the images sorted by
effective/descending, and then pick off the first one;  this would
keep an image around until supplanted by a newer one.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org