diff options
author | Ian Clatworthy <ian.clatworthy@canonical.com> | 2009-10-09 15:42:53 +1000 |
---|---|---|
committer | Ian Clatworthy <ian.clatworthy@canonical.com> | 2009-10-09 15:42:53 +1000 |
commit | 3e02777de0216d80d19f56e5b0436673675781f5 (patch) | |
tree | a114da3c932b7339a66cfcc5c6823e32e35b9119 | |
parent | b4feab671585d451b21d14d2a54ecabcb1eea4af (diff) | |
download | python-fastimport-3e02777de0216d80d19f56e5b0436673675781f5.tar.gz |
fix date parsing bug found while importing samba
-rw-r--r-- | parser.py | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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: |