From 5dacf19a5dd0e4c00d2658f3f1368247ed232500 Mon Sep 17 00:00:00 2001 From: helmutm Date: Sun, 3 Oct 2010 13:37:45 +0000 Subject: [PATCH] prepare fault-tolerant date parsing (not used at the moment git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@4027 fd906abe-77d9-0310-91a1-e0d9ade77398 --- integrator/office/base.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/integrator/office/base.py b/integrator/office/base.py index 304ba87..e7050c8 100644 --- a/integrator/office/base.py +++ b/integrator/office/base.py @@ -129,7 +129,15 @@ class OfficeFile(ExternalFileAdapter): def parseDate(s): if not s: return None - dt = datetime(*strptime(s, '%Y-%m-%dT%H:%M:%SZ')[:6]) + timedelta(hours=2) + tt = strptime(s, '%Y-%m-%dT%H:%M:%SZ') + #try: + # tt = strptime(s, '%Y-%m-%dT%H:%M:%SZ') + #except ValueError: + # try: + # tt = strptime(s, '%d.%m.%y') + # except ValueError: + # tt = strptime(s, '%d.%m.%Y') + dt = datetime(*tt[:6]) + timedelta(hours=2) return date(dt.year, dt.month, dt.day) #return date(*strptime(s, '%Y-%m-%dT%H:%M:%SZ')[:3])