summaryrefslogtreecommitdiff
path: root/sleekxmpp/thirdparty/mini_dateutil.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-08-12 22:36:23 -0700
committerLance Stout <lancestout@gmail.com>2012-08-12 22:36:23 -0700
commit5c25208fb53e5fd08be032ce96307302d18ab27b (patch)
treebef66ea1a9de8f252cb5605868e9b73df85c2f36 /sleekxmpp/thirdparty/mini_dateutil.py
parent962dfad2166574955c7be6d12c930991b0f29403 (diff)
parent779c258e2797d3dbcaf9eb5f4c7636b4d76ff0e7 (diff)
downloadslixmpp-5c25208fb53e5fd08be032ce96307302d18ab27b.tar.gz
slixmpp-5c25208fb53e5fd08be032ce96307302d18ab27b.tar.bz2
slixmpp-5c25208fb53e5fd08be032ce96307302d18ab27b.tar.xz
slixmpp-5c25208fb53e5fd08be032ce96307302d18ab27b.zip
Merge branch 'master' into develop
Diffstat (limited to 'sleekxmpp/thirdparty/mini_dateutil.py')
-rw-r--r--sleekxmpp/thirdparty/mini_dateutil.py53
1 files changed, 29 insertions, 24 deletions
diff --git a/sleekxmpp/thirdparty/mini_dateutil.py b/sleekxmpp/thirdparty/mini_dateutil.py
index d0d3f2ea..93f26312 100644
--- a/sleekxmpp/thirdparty/mini_dateutil.py
+++ b/sleekxmpp/thirdparty/mini_dateutil.py
@@ -166,32 +166,34 @@ except:
(?P<month>[0-9]{2})?(?P=ymdsep)?
(?P<day> [0-9]{2})?
- (?: # time part... optional... at least hour must be specified
- (?:T|\s+)?
- (?P<hour>[0-9]{2})
- (?:
- # minutes, separated with :, or none, from hours
- (?P<hmssep>[:]?)
- (?P<minute>[0-9]{2})
+ (?P<time>
+ (?: # time part... optional... at least hour must be specified
+ (?:T|\s+)?
+ (?P<hour>[0-9]{2})
(?:
- # same for seconds, separated with :, or none, from hours
- (?P=hmssep)
- (?P<second>[0-9]{2})
+ # minutes, separated with :, or none, from hours
+ (?P<hmssep>[:]?)
+ (?P<minute>[0-9]{2})
+ (?:
+ # same for seconds, separated with :, or none, from hours
+ (?P=hmssep)
+ (?P<second>[0-9]{2})
+ )?
)?
- )?
-
- # fractions
- (?: [,.] (?P<frac>[0-9]{1,10}))?
-
- # timezone, Z, +-hh or +-hh:?mm. MUST BE, but complain if not there.
- (
- (?P<tzempty>Z)
- |
- (?P<tzh>[+-][0-9]{2})
- (?: :? # optional separator
- (?P<tzm>[0-9]{2})
+
+ # fractions
+ (?: [,.] (?P<frac>[0-9]{1,10}))?
+
+ # timezone, Z, +-hh or +-hh:?mm. MUST BE, but complain if not there.
+ (
+ (?P<tzempty>Z)
+ |
+ (?P<tzh>[+-][0-9]{2})
+ (?: :? # optional separator
+ (?P<tzm>[0-9]{2})
+ )?
)?
- )?
+ )
)?
$
""", re.X) # """
@@ -211,13 +213,16 @@ except:
for key in vals:
if vals[key] is None:
vals[key] = def_vals.get(key, 0)
- elif key not in ['ymdsep', 'hmssep', 'tzempty']:
+ elif key not in ['time', 'ymdsep', 'hmssep', 'tzempty']:
vals[key] = int(vals[key])
year = vals['year']
month = vals['month']
day = vals['day']
+ if m.group('time') is None:
+ return datetime.date(year, month, day)
+
h, min, s, us = None, None, None, 0
frac = 0
if m.group('tzempty') == None and m.group('tzh') == None: