##// END OF EJS Templates
helpers: added route_path_or_none helper for routes that might be added by plugins
ergo -
r780:71ba091b default
parent child Browse files
Show More
@@ -1946,6 +1946,13 b' def route_path(*args, **kwds):'
1946 1946 return req.route_path(*args, **kwds)
1947 1947
1948 1948
1949 def route_path_or_none(*args, **kwargs):
1950 try:
1951 return route_path(*args, **kwargs)
1952 except KeyError:
1953 return None
1954
1955
1949 1956 def static_url(*args, **kwds):
1950 1957 """
1951 1958 Wrapper around pyramids `route_path` function. It is used to generate
@@ -30,10 +30,10 b''
30 30 <li class="${'active' if c.active=='password' else ''}"><a href="${h.url('my_account_password')}">${_('Password')}</a></li>
31 31 <li class="${'active' if c.active=='auth_tokens' else ''}"><a href="${h.url('my_account_auth_tokens')}">${_('Auth Tokens')}</a></li>
32 32 ## TODO: Find a better integration of oauth views into navigation.
33 %try:
34 <li class="${'active' if c.active=='oauth' else ''}"><a href="${h.route_path('my_account_oauth')}">${_('OAuth Identities')}</a></li>
35 %except KeyError:
36 %endtry
33 <% my_account_oauth_url = h.route_path_or_none('my_account_oauth') %>
34 % if my_account_oauth_url:
35 <li class="${'active' if c.active=='oauth' else ''}"><a href="${my_account_oauth_url}">${_('OAuth Identities')}</a></li>
36 % endif
37 37 <li class="${'active' if c.active=='emails' else ''}"><a href="${h.url('my_account_emails')}">${_('My Emails')}</a></li>
38 38 <li class="${'active' if c.active=='repos' else ''}"><a href="${h.url('my_account_repos')}">${_('My Repositories')}</a></li>
39 39 <li class="${'active' if c.active=='watched' else ''}"><a href="${h.url('my_account_watched')}">${_('Watched')}</a></li>
General Comments 0
You need to be logged in to leave comments. Login now