[Vobject] Bug#747554: python-vobject: python3 branch

Enrico Zini enrico at enricozini.org
Mon Dec 22 14:41:57 CST 2014


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 <enrico at 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 <enrico at enricozini.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.skyhouseconsulting.com/pipermail/vobject/attachments/20141222/6397df7f/attachment.sig>


More information about the VObject mailing list