From 518e6b83fe584876686be139ddc90ce7e1190816 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Thu, 23 Nov 2023 18:11:38 +0100 Subject: [PATCH] Remove galaxy.web import from managers.users Replace calls to web.url_for with compatible url_builder. Since there is no real API route for those (they live in client controllers) we need to pass the path prefix as name... --- lib/galaxy/managers/users.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/managers/users.py b/lib/galaxy/managers/users.py index ee9b05c3ac78..2243f808b78e 100644 --- a/lib/galaxy/managers/users.py +++ b/lib/galaxy/managers/users.py @@ -56,7 +56,6 @@ MinimalManagerApp, ) from galaxy.util.hash_util import new_secure_hash_v2 -from galaxy.web import url_for log = logging.getLogger(__name__) @@ -499,8 +498,11 @@ def send_activation_email(self, trans, email, username): Send the verification email containing the activation link to the user's email. """ activation_token = self.__get_activation_token(trans, email) - activation_link = url_for( - controller="user", action="activate", activation_token=activation_token, email=escape(email), qualified=True + activation_link = trans.url_builder( + "/activate", + activation_token=activation_token, + email=escape(email), + qualified=True, ) template_context = { "name": escape(username), @@ -553,7 +555,7 @@ def send_reset_email(self, trans, payload, **kwd): else: reset_user, prt = self.get_reset_token(trans, email) if prt: - reset_url = url_for(controller="login", action="start", token=prt.token) + reset_url = trans.url_builder("/login/start", token=prt.token) body = PASSWORD_RESET_TEMPLATE % ( trans.app.config.hostname, prt.expiration_time.strftime(trans.app.config.pretty_datetime_format),