fix ValueError exception on diff page

* lib/compat.py (cvs_strptime): make compatibility function throw a
    ValueError when time is not in expected format, so it is more
    like the native function

* lib/viewcvs.py (rcs_date_reformat): catch ValueError exception


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@702 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/tags/1.0.0-rc1
rey4 2003-08-22 17:55:39 +00:00
parent 8e19ed6b2c
commit 844a8c1269
2 changed files with 5 additions and 5 deletions

View File

@ -57,7 +57,7 @@ else:
if match:
return tuple(map(int, match.groups())) + (0, 1, 0)
else:
return None
raise ValueError('date is not in cvs format')
#
# os.makedirs() is new to Python 1.5.2

View File

@ -2433,10 +2433,10 @@ def view_doc(request):
fp.close()
def rcsdiff_date_reformat(date_str):
date = compat.cvs_strptime(date_str)
if date:
return make_time_string(compat.timegm(date))
return date_str
try:
return compat.cvs_strptime(date_str)
except ValueError:
return date_str
_re_extract_rev = re.compile(r'^[-+]+ [^\t]+\t([^\t]+)\t((\d+\.)*\d+)$')
_re_extract_info = re.compile(r'@@ \-([0-9]+).*\+([0-9]+).*@@(.*)')