Re-ocurring Events

Robert Rawlins - Think Blue robert.rawlins at thinkbluemedia.co.uk
Thu Apr 26 05:26:23 EDT 2007


Hello Chaps,

 

A bit more of a complex one this time, and I thought I'd get your opinions
on the best way to achieve this. Basically I'm looking for a way to describe
a re-occurring event, like a calendar event or appointment I guess. I'm
likely to use an XML file for the definition of the events, but imagine I've
got an event that looks something like this.

 

<event start="2007-01-01 12:00:00" end="2007-01-01 15:00:00" repeat="daily"
/>

 

Now what I want to do is be able to build a class which has a function like
'getCurrentEvent()' which will return any events that should be occurring at
that time. So if the current system time and date is 2007-01-03 13:00:00
then it will return THAT event to me, but if it was say 2007-01-03 16:00:00
then it would not, as the event isn't 'due' to occur at that time. Make
sense?

 

What's the best way of handling this? I'm really a little lost as to how I
might get started, checking a static date time isn't a problem, it's when it
comes to these re-occurring events that I struggle a little. The idea is
that I would have 5 core repetitions, none, daily, weekly, monthly and
annually.

 

Or perhaps you guys have a more full proof method of describing the event in
the XML?

 

Any suggestions are more than welcome guys, thanks again for all your help
recently.

 

Rob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070426/72af036a/attachment.html>


More information about the Python-list mailing list