# HG changeset patch # User Daniel Dourvaris # Date 2019-02-28 12:34:19 # Node ID 0c9e5d5630494f64e0307d28fc21041cebf38169 # Parent 442219c2d4a95e8c0a7a287e726878491996d3e9 user-bookmarks: add ${server_url} template to be used in the links. diff --git a/rhodecode/apps/my_account/views/my_account.py b/rhodecode/apps/my_account/views/my_account.py --- a/rhodecode/apps/my_account/views/my_account.py +++ b/rhodecode/apps/my_account/views/my_account.py @@ -496,6 +496,7 @@ class MyAccountView(BaseAppView, DataGri if not user_bookmark: raise HTTPFound(redirect_url) + # repository set if user_bookmark.repository: repo_name = user_bookmark.repository.repo_name base_redirect_url = h.route_path( @@ -506,7 +507,7 @@ class MyAccountView(BaseAppView, DataGri .safe_substitute({'repo_url': base_redirect_url}) else: redirect_url = base_redirect_url - + # repository group set elif user_bookmark.repository_group: repo_group_name = user_bookmark.repository_group.group_name base_redirect_url = h.route_path( @@ -517,9 +518,11 @@ class MyAccountView(BaseAppView, DataGri .safe_substitute({'repo_group_url': base_redirect_url}) else: redirect_url = base_redirect_url - + # custom URL set elif user_bookmark.redirect_url: - redirect_url = user_bookmark.redirect_url + server_url = h.route_url('home').rstrip('/') + redirect_url = string.Template(user_bookmark.redirect_url) \ + .safe_substitute({'server_url': server_url}) log.debug('Redirecting bookmark %s to %s', user_bookmark, redirect_url) raise HTTPFound(redirect_url) diff --git a/rhodecode/templates/admin/my_account/my_account_bookmarks.mako b/rhodecode/templates/admin/my_account/my_account_bookmarks.mako --- a/rhodecode/templates/admin/my_account/my_account_bookmarks.mako +++ b/rhodecode/templates/admin/my_account/my_account_bookmarks.mako @@ -23,8 +23,11 @@ ${h.checkbox('remove', value=True)} - + +

+ ${_('Server URL is available as ${server_url} variable. E.g. Redirect url: ${server_url}/_admin/exception_tracker')} +