Method deserialize() fixed

- wrong handling of datetime objects

Change-Id: I5889bdb2f8129f6abf6f02c0aa2264c5bc214a98
Sem-Ver: bugfix
This commit is contained in:
Lisa Zangrando 2016-11-04 11:45:46 +01:00
parent 10601679f4
commit 396bca1bc0
1 changed files with 12 additions and 4 deletions

View File

@ -540,9 +540,17 @@ class SharedQuota(SynergyObject):
cls.resources = entity["resources"]
cls.enabled = entity["enabled"]
cls.lastAllocationTime = datetime.strptime(
entity["lastAllocationTime"], "%Y-%m-%dT%H:%M:%S.%f")
cls.lastReleaseTime = datetime.strptime(
entity["lastReleaseTime"], "%Y-%m-%dT%H:%M:%S.%f")
if isinstance(entity["lastAllocationTime"], datetime):
cls.lastAllocationTime = entity["lastAllocationTime"]
else:
cls.lastAllocationTime = datetime.strptime(
entity["lastAllocationTime"], "%Y-%m-%dT%H:%M:%S.%f")
if isinstance(entity["lastReleaseTime"], datetime):
cls.lastReleaseTime = entity["lastReleaseTime"]
else:
cls.lastReleaseTime = datetime.strptime(
entity["lastReleaseTime"], "%Y-%m-%dT%H:%M:%S.%f")
return quota