views:

66

answers:

0

I'm attempting to publish an ICS feed using django + vobject. As a test run, I have the following view defined:

def ical(request, user_id=None):
    cal = vobject.iCalendar()
    cal.add('method').value = 'PUBLISH'
    cal.add('calscale').value = 'GREGORIAN'
    cal.add('x-wr-calname').value = 'TestCal28'
    cal.add('x-wr-timezone').value = 'Australia/Sydney'
    cal.add('x-wr-caldesc').value = ''
    vevent = cal.add('vevent')
    vevent.add('dtstart').value = datetime.now()
    vevent.add('dtend').value = datetime(2010, 7, 22)
    vevent.add('dtstamp').value = datetime.now()
    vevent.add('summary').value = "Test event"
    icalstream = cal.serialize()
    response = HttpResponse(icalstream, mimetype='text/calendar')
    response['Filename'] = 'filename.ics'
    response['Content-Disposition'] = 'attachment; filename=filename.ics'

so if you care to go to rosters.davidmck.com/ical/ you should get served filename.ics, mimetype = text/calendar. So far so good.

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
PRODID:-//PYVOBJECT//NONSGML Version 1//EN
BEGIN:VEVENT
UID:20100720T073356Z-26389@Rafiki
DTSTART:20100720T173356
DTEND:20100722T000000
DTSTAMP:20100720T173356
SUMMARY:Test event
END:VEVENT
X-WR-CALDESC:
X-WR-CALNAME:TestCal28
X-WR-TIMEZONE:Australia/Sydney
END:VCALENDAR

This seems to be a more-or-less well formed ICS file: it will import to any and all calendaring application that I've tried, including manual upload to google calendar. If you subscribe to it via URL using Yahoo, it seems to work A-OK too. But here's the killer: Google Calendar just won't work as a subscription. If you attempt to add it by URL to goocal it just says "Importing Calendar from URL" for an eternity, sometimes generating a failure message (eventually).

More frustrating, if I just take that filename.ics and put it in some static file serving location (like http://rosters.davidmck.com/site_media/filename.ics), it still doesn't work.

As far as I can tell, both location (static and generated) are externally available. I've also tried just uploading the ics to a different web server and that actually seemed to work so I suspect Goocal doesn't like my webserver for some reason. It's driving me crazy, I can't think why.