Skip to content

Commit

Permalink
Remove galaxy.web import from managers.users
Browse files Browse the repository at this point in the history
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...
  • Loading branch information
davelopez committed Nov 23, 2023
1 parent f5a942c commit 518e6b8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/galaxy/managers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 518e6b8

Please sign in to comment.