Add UTC flag to date strings

This commit is contained in:
Patrick Jentsch 2021-09-14 12:51:49 +02:00
parent 0a9bea0740
commit def01d474e
2 changed files with 4 additions and 4 deletions

View File

@ -115,9 +115,9 @@ def corpus_analysis_get_meta_data(corpus_id):
metadata = {}
metadata['corpus_name'] = db_corpus.title
metadata['corpus_description'] = db_corpus.description
metadata['corpus_creation_date'] = db_corpus.creation_date.isoformat()
metadata['corpus_creation_date'] = db_corpus.creation_date.isoformat() + 'Z'
metadata['corpus_last_edited_date'] = \
db_corpus.last_edited_date.isoformat()
db_corpus.last_edited_date.isoformat() + 'Z'
client = corpus_analysis_clients.get(request.sid)
if client is None:
response = {'code': 424, 'desc': None, 'msg': 'Failed Dependency'}
@ -145,7 +145,7 @@ def corpus_analysis_get_meta_data(corpus_id):
for struct_attr in struct_attrs:
texts_metadata[text_id][struct_attr.attrs['name'][(len(text_attr.attrs['name']) + 1):]] = struct_attr.values_by_ids(list(range(struct_attr.attrs['size'])))[text_id] # noqa
metadata['corpus_all_texts'] = texts_metadata
metadata['corpus_analysis_date'] = datetime.utcnow().isoformat()
metadata['corpus_analysis_date'] = datetime.utcnow().isoformat() + 'Z'
metadata['corpus_cqi_py_protocol_version'] = client.api.version
metadata['corpus_cqi_py_package_version'] = cqi.__version__
# TODO: make this dynamically

View File

@ -59,7 +59,7 @@ def ressource_after_update_handler(mapper, connection, ressource):
# In order to be JSON serializable, DateTime attributes must be
# converted to a string
if isinstance(new_value, datetime):
new_value = new_value.isoformat()
new_value = new_value.isoformat() + 'Z'
jsonpatch.append(
{
'op': 'replace',