DateRecurringIndex

erstellt von Jens W. Klein — 04.08.2008 23:05

Index for Zope 2 catalogs; enables recurring events

RecurringOur new DateRecurringIndex is in a Beta state: ready for testing by the community! It has doctests explaining in-depth how the recurring calculation happens.

The existing hacks to enable recurring events in Plone and/or Zope - including those created in past by us - did not satisfy our needs and quality criteria anymore. A more general approach was needed.

After I wrote some indexes for Zopes catalog in past (RelationsIndex, DateRangeInRangeIndex), I decided to write a replacement for the classic DateIndex. It works as a transparent replacement: Install it and if you dont use the extra features you dont realize the difference.

If you want recurring behaviour the index needs three pieces of information from the object: 1) the start date, 2) the interval in seconds 3) the until date. Finally you need to configure how it handles timezones and daylight savings changes.

Python deals with the timezone problem in a sane way: Pythons datetime implementation together with pytz is a great choice, even if one need to cross daylight saving borders. Zopes DateTime implementation - well - is a bit outdated and does all this in a - sorry folks - absolute insane and dirty way. In short, its not possible to get meaningful timezone information from a DateTime an so its impossible to convert it to a python datetime nor to calculate with it. If you want sane handling here you need to provide the index a python datetime, best with a pytz timezone.

I plan to prepare a little demo product enabling Plone event type to recur. But first I need to use  this index myself in the bda.agenda at a customers site. Stay tuned!

Image Frattale Creative Commons License by Diego Cosenza

Artikelaktionen

dateutil usage

Kommentar von Jens W. Klein am 05.08.2008 10:16
Lennart Regebro wrote a mail suggesting the usage of dateutil and its icalendar conform recurring implementation instead of delta values in minutes. I think this will make it into a 2.0 version of the index. http://labix.org/python-dat[…]000d7abe698a5783a46b0731b57
Thanks!