From d70331f40f5a8d78a1dd59a8cebe951c436eea4a Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 3 Jun 2024 12:05:12 +0100 Subject: [PATCH] handle none password in error --- spinnman/spalloc/session.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spinnman/spalloc/session.py b/spinnman/spalloc/session.py index 12b5b2a48..63c892969 100644 --- a/spinnman/spalloc/session.py +++ b/spinnman/spalloc/session.py @@ -238,10 +238,13 @@ def renew(self) -> JsonObject: self.__login_form_url, r.status_code) m = csrf_matcher.search(r.text) if not m: - raise SpallocException( - "Could not establish temporary session to " - f"{self._service_url} for user {self.__username} " - f"with a {len(self.__password)} character password.") + msg = ("Could not establish temporary session to " + f"{self._service_url} for user {self.__username} ") + if self.__password is None: + msg += "with a no password" + else: + msg += f"with a {len(self.__password)} character password." + raise SpallocException(msg) csrf = m.group(1) session = r.cookies[_SESSION_COOKIE]