From def01d474e18dbe54c70729695f051a9ff40c5a7 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Tue, 14 Sep 2021 12:51:49 +0200
Subject: [PATCH] Add UTC flag to date strings
---
app/corpora/events.py | 6 +++---
app/events/sqlalchemy.py | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/corpora/events.py b/app/corpora/events.py
index a420993b..749de7b4 100644
--- a/app/corpora/events.py
+++ b/app/corpora/events.py
@@ -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
diff --git a/app/events/sqlalchemy.py b/app/events/sqlalchemy.py
index 50749c8b..9356cced 100644
--- a/app/events/sqlalchemy.py
+++ b/app/events/sqlalchemy.py
@@ -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',