From 9dce9ed961ec650371f7d189fd2c423edbe74710 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Fri, 8 Mar 2019 15:21:14 +0100 Subject: [PATCH] Check type before converting sync_date into string --- nailgun/entities.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nailgun/entities.py b/nailgun/entities.py index 8bd1e4ae..b70914f3 100644 --- a/nailgun/entities.py +++ b/nailgun/entities.py @@ -39,8 +39,8 @@ _poll_task, _get_entity_ids, _payload, - to_json_serializable, ) +from nailgun.entity_mixins import to_json_serializable # noqa: F401 if version_info.major == 2: # pragma: no cover from httplib import ACCEPTED, NO_CONTENT # pylint:disable=import-error @@ -7216,7 +7216,7 @@ def create_payload(self): """ data = super(SyncPlan, self).create_payload() - if 'sync_date' in data: + if isinstance(data.get('sync_date'), datetime): data['sync_date'] = data['sync_date'].strftime('%Y-%m-%d %H:%M:%S') return data