Robert Rawlins - Think Blue
robert.rawlins at thinkbluemedia.co.uk
Fri Apr 27 12:42:37 CEST 2007
Ok, Almost done now, it seems to be working a real charm at the moment.
I need a little help on performing a quick if statement against a date
string. I have couple of date strings returned by
and I need to do and conditional that ensures start is before today's
date/time and end is after today's date/time.
The string looks like: '2007-01-01 00:00:00'
Do I have to convert this to a proper time object to do the comparison? Or
can I do it as a string?
From: python-list-bounces+robert.rawlins=thinkbluemedia.co.uk at python.org
[mailto:python-list-bounces+robert.rawlins=thinkbluemedia.co.uk at python.org]
On Behalf Of Robert Rawlins - Think Blue
Sent: 27 April 2007 09:55
To: 'Laurent Pointal'
Cc: python-list at python.org
Subject: RE: Re-ocurring Events
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.
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 couldnt
> 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
> 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
> 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
> iteration of the loop and then search the XML for events in that date,
> I know that's a fairly intensive way of doing it, but if it works it
> Now, the loop is where I'm really struggling, I've not done any looping
> dates, can anyone give me a hand with this? How can I loop back in time
> now to beginning of 07 a week at a time? Do we have some form of dateAdd()
> 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.
CNRS-LIMSI dépt. CHM, groupes AMI et PS
Courriel: laurent.pointal at limsi.fr (prof)
laurent.pointal at laposte.net (perso)
Tél. 01 69 85 81 06 (prof)
Fax. 01 69 85 80 88
More information about the Python-list