diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2025-06-14 20:36:31 +0300 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2025-06-14 20:36:31 +0300 |
commit | 40fb066e2be579f07e8219bfa2306d66278b4b00 (patch) | |
tree | 992f58f2ac0d1fe8cf2c5888d1a957f2272bc2ee /core/views/expo.py | |
parent | d8cdf7bc5ac1d258b36a8548c354e82ca314197a (diff) | |
download | troggle-40fb066e2be579f07e8219bfa2306d66278b4b00.tar.gz troggle-40fb066e2be579f07e8219bfa2306d66278b4b00.tar.bz2 troggle-40fb066e2be579f07e8219bfa2306d66278b4b00.zip |
refactoring cookie age as a function not a constant
Diffstat (limited to 'core/views/expo.py')
-rw-r--r-- | core/views/expo.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/views/expo.py b/core/views/expo.py index 2d617b8..723f772 100644 --- a/core/views/expo.py +++ b/core/views/expo.py @@ -14,7 +14,7 @@ import troggle.core.views.caves import troggle.settings as settings from troggle.core.models.caves import Cave from troggle.core.utils import ( - COOKIE_MAX_AGE, + get_cookie_max_age, WriteAndCommitError, current_expo, git_string, @@ -493,8 +493,8 @@ def editexpopage(request, path): if not filefound or result != html: # Check if content changed at all edit_response = HttpResponseRedirect(reverse("expopage", args=[path])) # Redirect after POST - edit_response.set_cookie('editor_id', editor, max_age=COOKIE_MAX_AGE) # cookie expires after COOKIE_MAX_AGE seconds - print(f"Cookie set: {editor} for {COOKIE_MAX_AGE/(24*3600)} days") + edit_response.set_cookie('editor_id', editor, max_age=get_cookie_max_age()) # cookie expires after get_cookie_max_age() seconds + print(f"Cookie set: {editor} for {get_cookie_max_age()/(3600)} hour(s)") try: change_message = pageform.cleaned_data["change_message"] write_and_commit([(filepath, result, "utf-8")], f"{change_message} - online edit of {path}", editor) @@ -610,7 +610,7 @@ def edittxtpage(request, path, filepath): savepath = "/" + path print(f"redirect {savepath}") response = redirect(savepath) # Redirect after POST - response.set_cookie('editor_id', editor, max_age=COOKIE_MAX_AGE) # cookie expires after COOKIE_MAX_AGE seconds + response.set_cookie('editor_id', editor, max_age=get_cookie_max_age()) # cookie expires after get_cookie_max_age() seconds return response else: |