> 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.

This will not solve all your problems, but a very convenient way of
handling XML is the element tree module (that comes with python 2.5):
http://docs.python.org/lib/module-xml.etree.ElementTree.html

HTH,
Daniel
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to