From 32be08bebb6d43c6e446dec12526cd912727c6fb Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Tue, 17 Sep 2024 19:37:09 +0300 Subject: Pass in the createtime as an arg when inserting into RDF graph. * gn3/api/metadata_api/wiki.py (edit_wiki): Pass in the createtime as an arg. * gn3/db/rdf/wiki.py: Remove un-used imports. (update_wiki_comment): Use passed in "created" arg in the createtime field. This makes sure that the SQL/RDF timestamps match. Signed-off-by: Munyoki Kilyungi --- gn3/db/rdf/wiki.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'gn3/db') diff --git a/gn3/db/rdf/wiki.py b/gn3/db/rdf/wiki.py index 55f4162..f19670a 100644 --- a/gn3/db/rdf/wiki.py +++ b/gn3/db/rdf/wiki.py @@ -9,17 +9,13 @@ NOTE: In the CONSTRUCT queries below, we manually sort the arrays from """ -import datetime - from string import Template from gn3.db.rdf import ( BASE_CONTEXT, RDF_PREFIXES, query_frame_and_compact, - sparql_query, update_rdf, ) -from gn3.db.wiki import MissingDBDataException WIKI_CONTEXT = BASE_CONTEXT | { @@ -192,6 +188,7 @@ CONSTRUCT { def update_wiki_comment( comment_id: int, payload: dict, + created: str, next_version: int, sparql_conf: dict, graph: str = "", @@ -234,7 +231,7 @@ dct:created "$created"^^xsd:datetime . comment=payload["comment"], name=name, symbol=payload['symbol'], comment_id=comment_id, next_version=next_version, - created=datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d %H:%M:%S')) + created=created) using = "" if payload["email"]: comment_triple += f"{name} foaf:mbox <{payload['email']}> .\n" -- cgit v1.2.3