diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -1946,6 +1946,13 @@ def route_path(*args, **kwds): return req.route_path(*args, **kwds) +def route_path_or_none(*args, **kwargs): + try: + return route_path(*args, **kwargs) + except KeyError: + return None + + def static_url(*args, **kwds): """ Wrapper around pyramids `route_path` function. It is used to generate diff --git a/rhodecode/templates/admin/my_account/my_account.html b/rhodecode/templates/admin/my_account/my_account.html --- a/rhodecode/templates/admin/my_account/my_account.html +++ b/rhodecode/templates/admin/my_account/my_account.html @@ -30,10 +30,10 @@
  • ${_('Password')}
  • ${_('Auth Tokens')}
  • ## TODO: Find a better integration of oauth views into navigation. - %try: -
  • ${_('OAuth Identities')}
  • - %except KeyError: - %endtry + <% my_account_oauth_url = h.route_path_or_none('my_account_oauth') %> + % if my_account_oauth_url: +
  • ${_('OAuth Identities')}
  • + % endif
  • ${_('My Emails')}
  • ${_('My Repositories')}
  • ${_('Watched')}