Skip to content
Snippets Groups Projects
Commit e488c06f authored by Chris Pastl's avatar Chris Pastl
Browse files

deserialize dates only if both values are set

parent 8d29c841
No related branches found
No related tags found
1 merge request!8Add return value for "/trackservice", improve logging #41
......@@ -36,13 +36,14 @@ def list_tracks(from_date=None, to_date=None, page=None, limit=None): # noqa: E
fd = None
td = None
try:
fd = util.deserialize_datetime(from_date)
td = util.deserialize_datetime(to_date)
except Exception:
service.logger.info(
"Invalid 'from_date' (%s) or 'to_date' (%s) for 'list_tracks'"
% (str(from_date), str(to_date))
)
if from_date is not None and to_date is not None:
try:
fd = util.deserialize_datetime(from_date)
td = util.deserialize_datetime(to_date)
except Exception:
service.logger.info(
"Invalid 'from_date' (%s) or 'to_date' (%s) for 'list_tracks'"
% (str(from_date), str(to_date))
)
return service.list_tracks(page, limit, fd, td)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment