On Fri, Sep 12, 2014 at 06:07:14PM +0200, chrysn wrote: > following my bug report on [1], i have ported vobject to python3, it now > passes all the unit tests (on which it was attempted to keep chanes > minimal).
Hello, thanks for porting vobject to python3: I also have a need for it, and I'm enjoying your port quite a lot. Hic! I was sad to read that upstream looks inactive. I have added this patch on top of your work, as porting somehow dropped that check, and I stumbled on an .ics feed with a broken year: commit 74b4fd0a90929ee7b88400e97358b84df13846cb Author: Enrico Zini <enr...@enricozini.org> Date: Mon Dec 22 21:39:00 2014 +0100 Deal with out of range years diff --git a/vobject/icalendar.py b/vobject/icalendar.py index ec6079a..f982f5c 100644 --- a/vobject/icalendar.py +++ b/vobject/icalendar.py @@ -1606,6 +1606,10 @@ def stringToDateTime(s, tzinfo=None): tzinfo = utc except: 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) Enrico -- GPG key: 4096R/E7AD5568 2009-05-08 Enrico Zini <enr...@enricozini.org>
signature.asc
Description: Digital signature