summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMichael Manfre2022-12-05 16:48:02 -0500
committerGitHub2022-12-05 14:48:02 -0700
commit238268eb3164e418656d3d23defd9d9a52423256 (patch)
tree30efbfa0fa7654762649a0ef8099ebf65d8cc1b5 /core
parent22e25ac454b52686685d4d9f1241416cd35fafda (diff)
downloadtakahe-238268eb3164e418656d3d23defd9d9a52423256.tar.gz
takahe-238268eb3164e418656d3d23defd9d9a52423256.tar.bz2
takahe-238268eb3164e418656d3d23defd9d9a52423256.zip
Add pylibmc and pymemcache to requirements and make timeout not lazy (#116)
Diffstat (limited to 'core')
-rw-r--r--core/decorators.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/decorators.py b/core/decorators.py
index 4934b60..fece564 100644
--- a/core/decorators.py
+++ b/core/decorators.py
@@ -16,8 +16,7 @@ def cache_page(
timeout can either be the number of seconds or the name of a SystemOptions
value.
"""
- if isinstance(timeout, str):
- timeout = Config.lazy_system_value(timeout)
+ _timeout = timeout
def decorator(function):
@wraps(function)
@@ -26,10 +25,11 @@ def cache_page(
if per_identity:
identity_id = request.identity.pk if request.identity else "0"
prefix = f"{key_prefix or ''}:ident{identity_id}"
- _timeout = timeout
- if callable(_timeout):
- _timeout = _timeout()
- return dj_cache_page(timeout=_timeout, key_prefix=prefix)(function)(
+ if isinstance(_timeout, str):
+ timeout = getattr(Config.system, _timeout)
+ else:
+ timeout = _timeout
+ return dj_cache_page(timeout=timeout, key_prefix=prefix)(function)(
request, *args, **kwargs
)