Edgewall Software
Modify

Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#4040 closed defect (fixed)

iCal calendar from Trac roadmap is incomprehensible to Google Calendar

Reported by: Jeffrey.Haemer Owned by: Christopher Lenz
Priority: normal Milestone: 0.10.3
Component: roadmap Version: 0.10
Severity: normal Keywords: calendar patch
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Emmanuel Blot)

Trac publishes a Roadmap calendar, of milestones, in iCal format. These calendars add to or import into gCal, but no events display. Here's why:

A VEVENT from Trac has date stamps in this format:

   DTSTAMP;VALUE=DATE:20061016

Google Calendar expects iCal date stamps to have this format:

   DTSTAMP;VALUE=DATE:20061016T222301Z

It appears that only the DTSTAMP field is the problem — all other date/time fields can have the first format.

Trac calendars do add or import successfully in Apple's iCal.

It would be useful to me, and the folks I work with, to be able to see Trac Roadmaps in Google Calendar. We may not be alone. :-)

Attachments (0)

Change History (8)

comment:1 by Emmanuel Blot, 18 years ago

Description: modified (diff)
Keywords: calendar added

in reply to:  description comment:2 by bbest@…, 18 years ago

I was able to simulate the desired time format by updating a single line of the write_date function ("write_prop…") in source:trunk/trac/ticket/roadmap.py:

        def write_date(name, value, params={}):
            params['VALUE'] = 'DATE'
            #write_prop(name, strftime('%Y%m%d', value), params)
            write_prop(name, strftime('%Y%m%dT%H%M%SZ', value), params)

        # ... above gets called below by ...

            write_date('DTSTAMP', localtime(milestone['due']))
            write_date('DTSTART', localtime(milestone['due']))

But Google Calendar still cannot read my Trac Roadmap iCalendar file. It did seem to recognize the name of the calendar ("[projectname] - roadmap") after the fix though.

The above solution is not ideal, because the time specified should be Z as in Zulu = GMT. So the preferred time function to use would be gmtime instead of localtime. This function is not yet imported at the top of the file, but would look like so:

from time import localtime, strftime, time, gmtime

Please let me know (bbest@…) if anyone makes progress with this, as I would very much like to access these Roadmap iCalendars with Google Calendar. Trac + Google = good times ;)

Thanks!

comment:3 by sid, 18 years ago

As the original poster pointed out, the problem is not with all dates listed in the calendar, just the VEVENT DTSTAMP ones. So the changes listed in comment:2 might be a little broad. The desired change is from:

BEGIN:VEVENT
UID:</trac/milestone/1.0.2@example.com/trac>
DTSTAMP;VALUE=DATE:20061110
DTSTART;VALUE=DATE:20061110

to:

BEGIN:VEVENT
UID:</trac/milestone/1.0.2@example.com/trac>
DTSTAMP:20061110T222301Z
DTSTART;VALUE=DATE:20061110

According to the iCal RFC 2445, the current implementation does not conform:

4.8.7.2 Date/Time Stamp

Property Name: DTSTAMP

Purpose: The property indicates the date/time that the instance of the iCalendar object was created.

Value Type: DATE-TIME

Description: The value MUST be specified in the UTC time format.

Example:

DTSTAMP:19971210T080000Z

comment:4 by sid, 18 years ago

You probably want something more like this (untested):

  • trac/ticket/roadmap.py

     
    293293            if milestone.has_key('due'):
    294294                write_prop('BEGIN', 'VEVENT')
    295295                write_prop('UID', uid)
    296                 write_date('DTSTAMP', localtime(milestone['due']))
     296                write_utctime('DTSTAMP', localtime(milestone['due']))
    297297                write_date('DTSTART', localtime(milestone['due']))
    298298                write_prop('SUMMARY', 'Milestone %s' % milestone['name'])
    299299                write_prop('URL', req.base_url + '/milestone/' +

comment:5 by sid, 18 years ago

Keywords: patch added
Milestone: 0.10.3
Summary: iCal calendar from Trac roadmap incomprehensible to Google CalendariCal calendar from Trac roadmap is incomprehensible to Google Calendar

I just tested the code in comment:4 and it worked for me on both Google Calendar and iCal.

comment:6 by Christopher Lenz, 18 years ago

Resolution: fixed
Status: newclosed

Patch applied in [4306], ported to stable in [4307]. Thanks for the patch and the testing!

comment:7 by sid, 18 years ago

That patch was from me, but that's okay ;)

comment:8 by Tim Hatch <trac@…>, 18 years ago

Just give my next one to Sid, we'll call it even.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.