From 40fb066e2be579f07e8219bfa2306d66278b4b00 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sat, 14 Jun 2025 20:36:31 +0300 Subject: refactoring cookie age as a function not a constant --- core/views/caves.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/views/caves.py') diff --git a/core/views/caves.py b/core/views/caves.py index 66a4943..b6a9127 100644 --- a/core/views/caves.py +++ b/core/views/caves.py @@ -21,7 +21,7 @@ from troggle.core.models.caves import Cave, CaveAndEntrance, Entrance, GetCaveLo from troggle.core.models.logbooks import QM from troggle.core.models.wallets import Wallet from troggle.core.utils import ( - COOKIE_MAX_AGE, + get_cookie_max_age, WriteAndCommitError, current_expo, get_editor, @@ -547,7 +547,7 @@ def edit_cave(request, path="", slug=None): edit_response = HttpResponseRedirect("/" + cave.url) else: edit_response = HttpResponseRedirect(reverse("newentrance", args = [cave.url_parent(), cave.slug()])) - edit_response.set_cookie('editor_id', editor, max_age=COOKIE_MAX_AGE) # cookie expires after COOKIE_MAX_AGE seconds + edit_response.set_cookie('editor_id', editor, max_age=get_cookie_max_age()) # cookie expires after get_cookie_max_age() seconds try: cave_file = cave.file_output() @@ -777,7 +777,7 @@ def edit_entrance(request, path="", caveslug=None, entslug=None): try: write_and_commit([entrance_file, cave_file], f"Online edit of entrance {entrance.slug}", editor) edit_response = HttpResponseRedirect("/" + cave.url) - edit_response.set_cookie('editor_id', editor, max_age=COOKIE_MAX_AGE) # cookie expires after COOKIE_MAX_AGE seconds + edit_response.set_cookie('editor_id', editor, max_age=get_cookie_max_age()) # cookie expires after get_cookie_max_age() seconds return edit_response except Exception as e: efilepath, econtent, eencoding = entrance_file -- cgit v1.2.3