[Calendarserver-maintainers] Bug#574133: Import of Google Calendar ICAL file fails with "year is out of range" parse error

Daniel Watkins daniel at daniel-watkins.co.uk
Tue Mar 16 16:09:01 UTC 2010

Package: python-vobject
Version: 0.8.1c-3
Severity: normal
Tags: patch

Google allows iCal entries to have a datetime with year set to 0.  Python objects to this, as 0 is less than datetime.MIN_YEAR.  The patch just normalises the year info to be within Python's year bounds.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-trunk-686 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages python-vobject depends on:
ii  python                        2.5.4-9    An interactive high-level object-o
ii  python-dateutil               1.4.1-3    powerful extensions to the standar
ii  python-support          automated rebuilding support for P

python-vobject recommends no packages.

python-vobject suggests no packages.

-- no debconf information
-------------- next part --------------
--- /home/daniel/icalendar.py	2010-03-16 15:52:35.000000000 +0000
+++ icalendar.py	2010-03-16 15:54:43.000000000 +0000
@@ -1617,6 +1617,11 @@
                 tzinfo = utc
         raise ParseError("'%s' is not a valid DATE-TIME" % s)
+    if year < datetime.MINYEAR:
+        year = datetime.MINYEAR
+    if year > datetime.MAXYEAR:
+        year = datetime.MAXYEAR
     return datetime.datetime(year, month, day, hour, minute, second, 0, tzinfo)

More information about the Calendarserver-maintainers mailing list