From ajs17 at cornell.edu Tue Jun 14 21:18:09 2005 From: ajs17 at cornell.edu (Adam J Smith) Date: Tue, 14 Jun 2005 15:18:09 -0400 (EDT) Subject: [icalendar-dev] anyone parsing radicalendar data? Message-ID: <3356.128.253.230.141.1118776689.squirrel@128.253.230.141> I am trying to help someone integrate the events stored in "radicalendar" (http://www.radicalendar.org/) into a Zope site, using the Python iCalendar library for parsing an iCalendar file from radicalendar and the displaying it via dtml-calendar. I am encountering a problem and wonder if anyone else is familiar with radicalendar's iCalendar files. (I am new to the iCalendar format.) I have installed and tested everything, and it appears to be working with my test data (minimal iCalendar text), but when I use the text of the iCalendar file from radicalendar, my Calendar variable is set to None. (No exceptions are raised.) After exhaustively testing my code and not seeing what the problem was, and from seeing that others are using the Python iCalendar package without significant problems, I tried importing the radicalendar iCalendar file into other iCalendar clients. KOrganizer wouldn't display anything, and Apple's iCal would only display a few of the events in the file. So, I think that radicalendar's iCalendar files are off, but I am not yet familiar enough with the iCalendar format to spot it. I am hoping that someone on the list who has used radicalendar and is more familiar with iCalendar in general can tell me something like, 'oh yeah, just trim whitespace' or something similarly easy to allow the Python module to parse them. Alternately, just knowing that there are problems with radicalendar would ease my mind a little. Just so you know, I have searched radicalendar's site, google, etc. and can't find really any meaningful information about anyone's use of radicalendar's iCalendar files, problems or otherwise. Any help is appreciated. ____________________________ adam smith ajs17 at cornell.edu 255-8893 215 ccc From maxm at mxm.dk Tue Jun 14 21:44:09 2005 From: maxm at mxm.dk (Max M) Date: Tue, 14 Jun 2005 21:44:09 +0200 Subject: [icalendar-dev] anyone parsing radicalendar data? In-Reply-To: <3356.128.253.230.141.1118776689.squirrel@128.253.230.141> References: <3356.128.253.230.141.1118776689.squirrel@128.253.230.141> Message-ID: <42AF3389.908@mxm.dk> Adam J Smith wrote: >So, I think that radicalendar's iCalendar files are off, but I am not yet >familiar enough with the iCalendar format to spot it. I am hoping that >someone on the list who has used radicalendar and is more familiar with >iCalendar in general can tell me something like, 'oh yeah, just trim >whitespace' or something similarly easy to allow the Python module to >parse them. Alternately, just knowing that there are problems with >radicalendar would ease my mind a little. > What a nicely framed question! I will bet you a beer that you have non spec line endings in your file. line endings in an iCalendar file *must* be '\r\n' if you have opened the file in a Linux editor and saved it from there you probably have '\n' line endings -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science From ajs17 at cornell.edu Thu Jun 16 03:02:11 2005 From: ajs17 at cornell.edu (Adam J Smith) Date: Wed, 15 Jun 2005 21:02:11 -0400 (EDT) Subject: [icalendar-dev] anyone parsing radicalendar data? Message-ID: <38808.69.202.76.112.1118883731.squirrel@69.202.76.112> (I just realized that I only sent this to Max, not the list. Sorry for my confusion.) For the sake of completing this thread... I contacted the radicalendar folks and there was indeed a very minor problem in the generation of their iCalendar files that they have graciously fixed tonight. I probably will revisit this tomorrow, but I suspect everything will go smoothly now. Wow, isn't open source great? Thanks again for your support. I suspect I will be using the Python iCalendar package quite a bit more in the future... By the way, if I get this concoction of mine working (iCalendar.py -> dtml-calendar tag) would anyone be interested in the recipe? It is probably the most bare-boned approach to integrating an existing calendar's data into a Zope site. If so, I will post it to the list. ____________________________ adam smith ajs17 at cornell.edu 255-8893 215 ccc From ajs17 at cornell.edu Thu Jun 16 03:08:33 2005 From: ajs17 at cornell.edu (Adam J Smith) Date: Wed, 15 Jun 2005 21:08:33 -0400 (EDT) Subject: [icalendar-dev] anyone parsing radicalendar data? Message-ID: <58410.69.202.76.112.1118884113.squirrel@69.202.76.112> I need a little more help on my iCalendar adventures. Trying to process my iCalendar file through the interactive shell, I get the following error: Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/site-packages/icalendar/cal.py", line 343, in from_string name, params, vals = line.parts() File "/usr/lib/python2.4/site-packages/icalendar/parser.py", line 318, in parts raise ValueError, 'Content line could not be parsed into parts' ValueError: Content line could not be parsed into parts I changed the exception handling in the module to print the line that is causing the problem: Content line could not be parsed into parts: ORGANIZER;CN="Ithaca Catholic Worker" Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/site-packages/icalendar/cal.py", line 343, in from_string name, params, vals = line.parts() TypeError: unpack non-sequence This is the first instance of an ORGANIZER field in the file. If I add a :mailto: piece: ORGANIZER;CN="Ithaca Catholic Worker":mailto:mstephens at ithaca.edu it processes the line and fails on the very next ORGANIZER line that looks like the first one did: ORGANIZER;CN="The Martinez Family I tried reading through the iCalendar spec which seems to show that either is valid, but I admit that I haven't had time to digest the spec carefully, so I would welcome some enlightenment on this from those who can recite the spec in their sleep. Thanks again for any help! ____________________________ adam smith ajs17 at cornell.edu 255-8893 215 ccc From faassen at infrae.com Fri Jun 17 11:59:00 2005 From: faassen at infrae.com (Martijn Faassen) Date: Fri, 17 Jun 2005 11:59:00 +0200 Subject: [icalendar-dev] anyone parsing radicalendar data? In-Reply-To: <42AF3389.908@mxm.dk> References: <3356.128.253.230.141.1118776689.squirrel@128.253.230.141> <42AF3389.908@mxm.dk> Message-ID: <42B29EE4.7050003@infrae.com> Max M wrote: > Adam J Smith wrote: > >> So, I think that radicalendar's iCalendar files are off, but I am not yet >> familiar enough with the iCalendar format to spot it. I am hoping that >> someone on the list who has used radicalendar and is more familiar with >> iCalendar in general can tell me something like, 'oh yeah, just trim >> whitespace' or something similarly easy to allow the Python module to >> parse them. Alternately, just knowing that there are problems with >> radicalendar would ease my mind a little. >> > > What a nicely framed question! > > I will bet you a beer that you have non spec line endings in your file. > > line endings in an iCalendar file *must* be '\r\n' if you have opened > the file in a Linux editor and saved it from there you probably have > '\n' line endings. We do meet sure we raise an exception when the input doesn't make any sense in iCalendar in the future though, instead of just silently doing absolutely nothing. Regards, Martijn From faassen at infrae.com Fri Jun 17 12:00:17 2005 From: faassen at infrae.com (Martijn Faassen) Date: Fri, 17 Jun 2005 12:00:17 +0200 Subject: [icalendar-dev] anyone parsing radicalendar data? In-Reply-To: <38808.69.202.76.112.1118883731.squirrel@69.202.76.112> References: <38808.69.202.76.112.1118883731.squirrel@69.202.76.112> Message-ID: <42B29F31.6030109@infrae.com> Adam J Smith wrote: > (I just realized that I only sent this to Max, not the list. Sorry for my > confusion.) > > For the sake of completing this thread... > > I contacted the radicalendar folks and there was indeed a very minor > problem in the generation of their iCalendar files that they have > graciously fixed tonight. I probably will revisit this tomorrow, but I > suspect everything will go smoothly now. Wow, isn't open source great? Yup, agreed. :) > Thanks again for your support. I suspect I will be using the Python > iCalendar package quite a bit more in the future... Cool! > By the way, if I get this concoction of mine working (iCalendar.py -> > dtml-calendar tag) would anyone be interested in the recipe? It is > probably the most bare-boned approach to integrating an existing > calendar's data into a Zope site. If so, I will post it to the list. Sure, go ahead! Perhaps we can even have an area somewhere in svn where this stuff can be placed. Regards, Martijn From ajs17 at cornell.edu Sat Jun 18 18:17:18 2005 From: ajs17 at cornell.edu (Adam J Smith) Date: Sat, 18 Jun 2005 12:17:18 -0400 (EDT) Subject: [icalendar-dev] progress in radicalendar saga Message-ID: <39696.69.202.76.112.1119111438.squirrel@69.202.76.112> If you haven't gotten sick from hearing from me yet... Thanks to the help on this list, I have been communicating with the radicalendar developer who has quickly tweaked his iCalendar files for me, and now the iCalendar package is slicing through them like a hot knife through butter. Just one more thing that I can't figure out: how to get the (common?) name of the organizer from the ORGANIZER;CN. Saying something like this: for event in cal.walk('vevent'): event['organizer'] gives me the email address, which I definitely want also, but I can't figure out how to get the name, like Cornell for Peace & Justice from: ORGANIZER;CN="Cornell for Peace & Justice":mailto:info at cujustice.net I think this is the last thing that I was expecting to get that I don't know how to get, so when this is done, I will be able to write up everything I've done and post it to the list for the next newbie like me. The only other thing I can imagine having trouble figuring out is date fields. Do these values come back as either Python DateTime objects or strings that can easily be parsed into DateTime objects? Thanks again. ____________________________ adam smith ajs17 at cornell.edu 255-8893 215 ccc From ajs17 at cornell.edu Sat Jun 18 22:25:23 2005 From: ajs17 at cornell.edu (Adam J Smith) Date: Sat, 18 Jun 2005 16:25:23 -0400 (EDT) Subject: [icalendar-dev] progress in radicalendar saga In-Reply-To: <42B4569E.1080809@mxm.dk> References: <39696.69.202.76.112.1119111438.squirrel@69.202.76.112> <42B4569E.1080809@mxm.dk> Message-ID: <43619.69.202.76.112.1119126323.squirrel@69.202.76.112> > event['organizer'].params > > as far as I remember > Perfect! This works: >>> for event in thiscalendar.walk('vevent'): ... organizer = event.get('organizer', None) ... if organizer: ... print organizer.params.get('CN', None) ... Cornell for Peace & Justice Cornell for Peace & Justice Burmese Community of Ithaca >>> I will try to get this little thing of mine working smoothly and fully documented in the next week or so and post it to the list. Max M said: > Adam J Smith wrote: > >>If you haven't gotten sick from hearing from me yet... >> >>Thanks to the help on this list, I have been communicating with the >>radicalendar developer who has quickly tweaked his iCalendar files for >> me, >>and now the iCalendar package is slicing through them like a hot knife >>through butter. >> >>Just one more thing that I can't figure out: how to get the (common?) >> name >>of the organizer from the ORGANIZER;CN. Saying something like this: >> >>for event in cal.walk('vevent'): >> event['organizer'] >> > > event['organizer'].params > > as far as I remember > > > > > -- > > hilsen/regards Max M, Denmark > > http://www.mxm.dk/ > IT's Mad Science > > ____________________________ adam smith ajs17 at cornell.edu 255-8893 215 ccc From pj at sgi.com Fri Jun 24 23:15:35 2005 From: pj at sgi.com (Paul Jackson) Date: Fri, 24 Jun 2005 14:15:35 -0700 Subject: [icalendar-dev] new line support Message-ID: <20050624141535.35f6bcc4.pj@sgi.com> Last month, Ivan R. Judson started a thread on this icalendar list, recommending that icalendar accept '\n' terminated lines when reading *.ics files. I'd like to chime in, a bit late, and recommend the same thing. I'm trying to read *.ics files produced on my SuSE 9.3 Linux box using KDE's Korganizer 3.4 Calendar. It also produces *.ics files with lines terminated by '\n'. I had to debug what was going on, in order to figure out why importing these calendars into Python icalendar produced an empty calendar. Now that I know, I can easily enough add a filter in my small application to account for this. But it caught me right up front, in my first use of Python icalendar, for an hour or so of lost time == In case anyone else is traveling down the same path I am, my small app will be reparsing the *.ics file maintained by my Korganizer, in order to pick off what event is due up next, and send this to my cell phone in an email message. I will use Korganizer's alarm triggers to invoke my small app, a few minutes before the event. -- I won't rest till it's the best ... Programmer, Linux Scalability Paul Jackson 1.925.600.0401