Re-ocurring Events

Robert Rawlins - Think Blue robert.rawlins at thinkbluemedia.co.uk
Fri Apr 27 10:54:44 CEST 2007


Thanks for getting back to me Laurent.

I've now made some pretty tidy progress on this and -think- it's going to
shape up nicely, I'm just working on converting my date strings from the XML
into a date_struct and we should be good to go.

I'll keep you all posted.

Rob

-----Original Message-----
From: Laurent Pointal [mailto:laurent.pointal at limsi.fr] 
Sent: 27 April 2007 09:49
To: Robert Rawlins - Think Blue
Subject: Re: Re-ocurring Events

Robert Rawlins - Think Blue a écrit :
> Thank you guys for your suggestions.
> 
> I've been having a look at that launchd stuff from apple but couldn’t
really
> see how that applies to my requirements.

I was not thinking about launchd itself, but about its XML configuration 
files which manage timed events, as you need.

> I've been putting some serious thought into how this should work as its
> essentially the final part of the puzzle for my application, I'll have a
> fully working model for my application.
> 
> I've been thinking about the possibility of using a combination of xpath
to
> search the XML with some loops which change the date. As events won't ever
> be set to start before 01-01-2007 I can set that as the ceiling for my
loop.
> So when I'm searching for weekly events, I 'simply' take today's date and
> time and loop from now until 01-01-2007 decrementing the date by a week
each
> iteration of the loop and then search the XML for events in that date,
make
> sense?
> 
> I know that's a fairly intensive way of doing it, but if it works it
works.
> 
> Now, the loop is where I'm really struggling, I've not done any looping
with
> dates, can anyone give me a hand with this? How can I loop back in time
from
> now to beginning of 07 a week at a time? Do we have some form of dateAdd()
I
> can use with a while loop? Perhaps.

See datetime module, eventually third party mxDatetime.

> Date = (now)
> While date > 2007-01-01:
> 	Date = dateAdd(date, -1, w)
> 
> Something to that effect? Then I can quickly xpath for every iteration of
> the loop.

A+

Laurent.

-- 
Laurent POINTAL
CNRS-LIMSI dépt. CHM, groupes AMI et PS
Courriel: laurent.pointal at limsi.fr    (prof)
           laurent.pointal at laposte.net (perso)
Ouebe: http://www.limsi.fr/Individu/pointal/
Tél. 01 69 85 81 06 (prof)
Fax. 01 69 85 80 88






More information about the Python-list mailing list