[Zope-CMF] Querying Catalog for Today's events

Jon Edwards jon@pcgs.freeserve.co.uk
Mon, 4 Feb 2002 01:32:33 -0000


I'm trying to use CMFCalendar/Events to give a list of Today's events for an
organisation or person.

So I hacked Event.py so that 'edit' sets

     self.effective_date = self.start_date
     self.expiration_date = self.end_date

just before the reindexObject. That seems to work OK... at least the catalog
now shows the dates in 'effective' and 'expires'(and also in
'EffectiveDate', though 'ExpiresDate' never seems to have any content)

So then I hacked the news_box method to return all the events. Which worked
great, until I tried to query for events that were relevant today (i.e.
effective today or earlier, expires today or later). Here's the code for the
start of the repeat loop -

 <tbody tal:define="news python: here.portal_catalog(meta_type='CMF Event',
sort_on='expires', sort_order='reverse', review_state='published',
         effective={'query':'ZopeTime()', 'range':'max'},
expires={'query':'ZopeTime()', 'range':'min'});
         Batch python:modules['ZTUtils'].Batch;
		 global batch python:Batch(news, 10, 0, orphan=1)">

No matter what dates/times I set for events, they don't show up in the list!
Has anyone achieved this, or can anyone point out my mistakes?

Cheers, Jon