From 0a6f83ca490f3f28a69c339dca9194aabb5165a6 Mon Sep 17 00:00:00 2001 From: mutantsan Date: Mon, 25 Nov 2024 18:14:07 +0200 Subject: [PATCH] fix: fix should_store_previous_model_state func for python 2.10 --- ckanext/event_audit/config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ckanext/event_audit/config.py b/ckanext/event_audit/config.py index 8749cb3..af3fb26 100644 --- a/ckanext/event_audit/config.py +++ b/ckanext/event_audit/config.py @@ -19,6 +19,7 @@ CONF_TRACK_MODELS = "ckanext.event_audit.track.models" CONF_STORE_PREVIOUS_MODEL_STATE = "ckanext.event_audit.track.store_previous_model_state" +DEF_STORE_PREVIOUS_MODEL_STATE = False CONF_DATABASE_TRACK_ENABLED = "ckanext.event_audit.track_model" CONF_API_TRACK_ENABLED = "ckanext.event_audit.track_api" @@ -91,7 +92,9 @@ def should_store_payload_and_result() -> bool: def should_store_previous_model_state() -> bool: """Check if the previous state of the model should be stored in the event. Works only for in-built database listener.""" - return tk.config[CONF_STORE_PREVIOUS_MODEL_STATE] + return tk.config.get( + CONF_STORE_PREVIOUS_MODEL_STATE, DEF_STORE_PREVIOUS_MODEL_STATE + ) def get_batch_size() -> int: