From afc859dff74123c169ceb8fc19c811d9faeb0b2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Thu, 26 Oct 2023 23:10:51 +0200 Subject: [PATCH] bug: unhashable Config in `CalDAV.get_events` --- api/ovdashboard_api/core/config.py | 7 +++++++ api/ovdashboard_api/core/webdav.py | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/api/ovdashboard_api/core/config.py b/api/ovdashboard_api/core/config.py index 6c2be03..26123cf 100644 --- a/api/ovdashboard_api/core/config.py +++ b/api/ovdashboard_api/core/config.py @@ -89,6 +89,13 @@ class Config(BaseModel): Main representation of "config.txt". """ + def __hash__(self) -> int: + """ + Fake hash (the config is always the config) + """ + + return hash("config") + image_dir: str = "image" text_dir: str = "text" file_dir: str = "file" diff --git a/api/ovdashboard_api/core/webdav.py b/api/ovdashboard_api/core/webdav.py index cdb3052..860685b 100644 --- a/api/ovdashboard_api/core/webdav.py +++ b/api/ovdashboard_api/core/webdav.py @@ -15,10 +15,10 @@ from .settings import SETTINGS _logger = logging.getLogger(__name__) -def davkey(first, _, *args, **kwargs): +def davkey(name, _, *args, **kwargs): """Return a cache key for use with cached methods.""" - return hashkey(first, *args, **kwargs) + return hashkey(name, *args, **kwargs) class WebDAV: