Skip to content

Commit

Permalink
fix: fix should_store_previous_model_state func for python 2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
mutantsan committed Nov 25, 2024
1 parent d5667a7 commit 0a6f83c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ckanext/event_audit/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 0a6f83c

Please sign in to comment.