Revert "Some missing isinstance checks". Pushed directly.

This reverts commit 2a7dd73710.
This commit is contained in:
Pedro Algarvio 2018-03-14 14:01:22 +00:00
parent 2a7dd73710
commit 78c0b77afd
No known key found for this signature in database
GPG Key ID: BB36BF6584A298FF

View File

@ -1011,17 +1011,14 @@ class Schedule(object):
log.error('Invalid date string. Ignoring')
continue
else:
if isinstance(i, datetime.datetime):
when__ = i
else:
try:
when__ = dateutil_parser.parse(i)
except ValueError:
log.error(
'Invalid date string %s. Ignoring job %s.',
i, job
)
continue
try:
when__ = dateutil_parser.parse(i)
except ValueError:
log.error(
'Invalid date string %s. Ignoring job %s.',
i, job
)
continue
_when.append(when__)
if data['_splay']:
@ -1193,20 +1190,16 @@ class Schedule(object):
continue
else:
if isinstance(data['range'], dict):
start = data['range']['start']
end = data['range']['start']
if not isinstance(range_start, datetime.datetime):
try:
start = dateutil_parser.parse(start)
except ValueError:
log.error('Invalid date string for start. Ignoring job %s.', job)
continue
if not isinstance(end, datetime.datetime):
try:
end = dateutil_parser.parse(data['range']['end'])
except ValueError:
log.error('Invalid date string for end. Ignoring job %s.', job)
continue
try:
start = dateutil_parser.parse(data['range']['start'])
except ValueError:
log.error('Invalid date string for start. Ignoring job %s.', job)
continue
try:
end = dateutil_parser.parse(data['range']['end'])
except ValueError:
log.error('Invalid date string for end. Ignoring job %s.', job)
continue
if end > start:
if 'invert' in data['range'] and data['range']['invert']:
if now <= start or now >= end:
@ -1342,9 +1335,7 @@ class Schedule(object):
log.error('Missing python-dateutil. '
'Ignoring until.')
else:
until = data['until']
if not isinstance(until, datetime.datetime):
until = dateutil_parser.parse(until)
until = dateutil_parser.parse(data['until'])
if until <= now:
log.debug(
@ -1361,9 +1352,7 @@ class Schedule(object):
log.error('Missing python-dateutil. '
'Ignoring after.')
else:
after = data['after']
if not isinstance(after, datetime.datetime):
after = dateutil_parser.parse(data['after'])
after = dateutil_parser.parse(data['after'])
if after >= now:
log.debug(