From 9a35e0ae577addc2476ae9f652e33115485db11b Mon Sep 17 00:00:00 2001 From: mike chiu Date: Thu, 23 Jun 2016 14:18:14 +0800 Subject: [PATCH] Update date.py Fix some date response format like "11:47:37+0800" without colon. --- suds/sax/date.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/suds/sax/date.py b/suds/sax/date.py index 81a7a10..64df067 100644 --- a/suds/sax/date.py +++ b/suds/sax/date.py @@ -86,6 +86,7 @@ def __parse(self, s): - YYYY-MM-DD(z|Z) - YYYY-MM-DD+06:00 - YYYY-MM-DD-06:00 + - YYYY-MM-DD-0600 Although, the TZ is ignored because it's meaningless without the time, right? @param s: A date string. @@ -243,7 +244,7 @@ def __offset(self, s): @return: The signed offset in hours. @rtype: str """ - if len(s) == len('-00:00'): + if len(s) == len('-00:00') or len(s) == len('-0000'): return int(s[:3]) if len(s) == 0: return self.tz.local @@ -344,7 +345,7 @@ class Timezone: @type patten: L{re.RegexObject} """ - pattern = re.compile('([zZ])|([\-\+][0-9]{2}:[0-9]{2})') + pattern = re.compile('([zZ])|([\-\+][0-9]{2}:[0-9]{2})|([\-\+][0-9]{4})') def __init__(self): self.local = ( 0-time.timezone/60/60 )