From: Alex Morega Date: Mon, 6 Jan 2014 19:43:33 +0000 (+0200) Subject: rewrite regexp parsing X-Git-Tag: 2.0~3^2~6^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1df64dfe5d9e10f6725362d467278c5eb02e5162;p=thirdparty%2Fbabel.git rewrite regexp parsing --- diff --git a/babel/messages/catalog.py b/babel/messages/catalog.py index 82c08c88..756d64cc 100644 --- a/babel/messages/catalog.py +++ b/babel/messages/catalog.py @@ -41,12 +41,13 @@ PYTHON_FORMAT = re.compile(r'''(?x) def _parse_datetime_header(value): - value, tzoffset, _ = re.split('([+-]\d{4})$', value, 1) + match = re.match(r'^(?P.*)(?P[+-]\d{4})$', value) - tt = time.strptime(value, '%Y-%m-%d %H:%M') + tt = time.strptime(match.group('datetime'), '%Y-%m-%d %H:%M') ts = time.mktime(tt) # Separate the offset into a sign component, hours, and # minutes + tzoffset = match.group('tzoffset') plus_minus_s, rest = tzoffset[0], tzoffset[1:] hours_offset_s, mins_offset_s = rest[:2], rest[2:]