Commit 7707c07f authored by Alain Takoudjou's avatar Alain Takoudjou

grid.promise: add offset on UTC date

Add ofset +0000 to utc date so after convert to another timezone it still remain valid.

/reviewed-on !63
parent 9cb918df
...@@ -105,7 +105,7 @@ class PromiseQueueResult(object): ...@@ -105,7 +105,7 @@ class PromiseQueueResult(object):
'result': { 'result': {
'type': self.item.type(), 'type': self.item.type(),
'failed': self.item.hasFailed(), 'failed': self.item.hasFailed(),
'date': self.item.date.strftime('%Y-%m-%dT%H:%M:%S'), 'date': self.item.date.strftime('%Y-%m-%dT%H:%M:%S+0000'),
'message': self.item.message 'message': self.item.message
} }
} }
...@@ -115,12 +115,12 @@ class PromiseQueueResult(object): ...@@ -115,12 +115,12 @@ class PromiseQueueResult(object):
self.item = AnomalyResult( self.item = AnomalyResult(
problem=data['result']['failed'], problem=data['result']['failed'],
message=data['result']['message'], message=data['result']['message'],
date=datetime.strptime(data['result']['date'], '%Y-%m-%dT%H:%M:%S')) date=datetime.strptime(data['result']['date'], '%Y-%m-%dT%H:%M:%S+0000'))
elif data['result']['type'] == TestResult.type(): elif data['result']['type'] == TestResult.type():
self.item = TestResult( self.item = TestResult(
problem=data['result']['failed'], problem=data['result']['failed'],
message=data['result']['message'], message=data['result']['message'],
date=datetime.strptime(data['result']['date'], '%Y-%m-%dT%H:%M:%S')) date=datetime.strptime(data['result']['date'], '%Y-%m-%dT%H:%M:%S+0000'))
else: else:
raise ValueError('Unknown result type: %r' % data['result']['type']) raise ValueError('Unknown result type: %r' % data['result']['type'])
......
...@@ -925,7 +925,7 @@ exit 0 ...@@ -925,7 +925,7 @@ exit 0
"name": "my_promise.py", "name": "my_promise.py",
"execution-time": 0.1, "execution-time": 0.1,
"title": "my_promise" "title": "my_promise"
}""" % (datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S'), self.plugin_dir) }""" % (datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S+0000'), self.plugin_dir)
if not os.path.exists(os.path.dirname(state_file)): if not os.path.exists(os.path.dirname(state_file)):
os.makedirs(os.path.dirname(state_file)) os.makedirs(os.path.dirname(state_file))
...@@ -946,7 +946,7 @@ exit 0 ...@@ -946,7 +946,7 @@ exit 0
"name": "%(name)s", "name": "%(name)s",
"execution-time": 0.1, "execution-time": 0.1,
"title": "%(name)s" "title": "%(name)s"
}""" % {'date': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S'), }""" % {'date': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S+0000'),
'folder': self.legacy_promise_dir, 'folder': self.legacy_promise_dir,
'name': name} 'name': name}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment