Catch invalid date exceptions

svn: r9
This commit is contained in:
Don Allingham 2001-05-14 23:47:31 +00:00
parent 8be0e73765
commit 8f483328bd

View File

@ -61,11 +61,20 @@ class Date:
match = Date.fmt.match(text) match = Date.fmt.match(text)
if match: if match:
matches = match.groups() matches = match.groups()
self.start.set(matches[1]) try:
self.stop.set(matches[3]) self.start.set(matches[1])
except:
pass
try:
self.stop.set(matches[3])
except:
pass
self.range = 1 self.range = 1
else: else:
self.start.set(text) try:
self.start.set(text)
except:
pass
self.range = 0 self.range = 0
#-------------------------------------------------------------------- #--------------------------------------------------------------------
@ -102,11 +111,20 @@ class Date:
match = Date.fmt.match(text) match = Date.fmt.match(text)
if match: if match:
matches = match.groups() matches = match.groups()
self.start.set(matches[1]) try:
self.stop.set(matches[3]) self.start.set(matches[1])
except:
pass
try:
self.stop.set(matches[3])
except:
pass
self.range = 1 self.range = 1
else: else:
self.start.quick_set(text) try:
self.start.quick_set(text)
except:
pass
self.range = 0 self.range = 0
#------------------------------------------------------------------------- #-------------------------------------------------------------------------