From 111f95d34ee8f1b594939a7263423ad9acf43a31 Mon Sep 17 00:00:00 2001 From: Patrick Baus Date: Fri, 1 Nov 2024 12:15:29 +0100 Subject: [PATCH] Fixed mongo db url readout from env variable --- databases.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/databases.py b/databases.py index e38c584..9aa8e88 100644 --- a/databases.py +++ b/databases.py @@ -56,7 +56,10 @@ def __init__(self, **kwargs: Unpack[DatabaseParams]) -> None: def hostname(self) -> str: """Return the hostname including the port. Strips usernames and passwords.""" # strip usernames and password - return self.__params["host"][self.__params["host"].find("@") + 1 : self.__params["host"].rfind("/?")] + last_occurance = self.__params["host"].rfind("/?") + return self.__params["host"][ + self.__params["host"].find("@") + 1 : last_occurance if last_occurance >= 0 else len(self.__params["host"]) + ] async def __aenter__(self) -> Self: await self.__connect() @@ -179,6 +182,9 @@ def _log_database_error( ) async def monitor_changes(self, timeout: float) -> None: + """ + Will be called by the DatabaseManager context manager to produce a stream of database changes + """ raise NotImplementedError async def _monitor_database(