summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Clatworthy <ian.clatworthy@canonical.com>2009-10-09 15:42:53 +1000
committerIan Clatworthy <ian.clatworthy@canonical.com>2009-10-09 15:42:53 +1000
commit3e02777de0216d80d19f56e5b0436673675781f5 (patch)
treea114da3c932b7339a66cfcc5c6823e32e35b9119
parentb4feab671585d451b21d14d2a54ecabcb1eea4af (diff)
downloadpython-fastimport-3e02777de0216d80d19f56e5b0436673675781f5.tar.gz
fix date parsing bug found while importing samba
-rw-r--r--parser.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/parser.py b/parser.py
index be06ca9..43d47db 100644
--- a/parser.py
+++ b/parser.py
@@ -504,7 +504,7 @@ class ImportParser(LineBasedParser):
"""
match = _WHO_AND_WHEN_RE.search(s)
if match:
- datestr = match.group(3)
+ datestr = match.group(3).lstrip()
if self.date_parser is None:
# auto-detect the date format
if len(datestr.split(' ')) == 2:
@@ -514,7 +514,11 @@ class ImportParser(LineBasedParser):
else:
format = 'rfc2822'
self.date_parser = dates.DATE_PARSERS_BY_NAME[format]
- when = self.date_parser(datestr, self.lineno)
+ try:
+ when = self.date_parser(datestr, self.lineno)
+ except ValueError:
+ print "failed to parse datestr '%s'" % (datestr,)
+ raise
else:
match = _WHO_RE.search(s)
if accept_just_who and match: