##// 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 return req.route_path(*args, **kwds)
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 def static_url(*args, **kwds):
1956 def static_url(*args, **kwds):
1950 """
1957 """
1951 Wrapper around pyramids `route_path` function. It is used to generate
1958 Wrapper around pyramids `route_path` function. It is used to generate
@@ -30,10 +30,10 b''
30 <li class="${'active' if c.active=='password' else ''}"><a href="${h.url('my_account_password')}">${_('Password')}</a></li>
30 <li class="${'active' if c.active=='password' else ''}"><a href="${h.url('my_account_password')}">${_('Password')}</a></li>
31 <li class="${'active' if c.active=='auth_tokens' else ''}"><a href="${h.url('my_account_auth_tokens')}">${_('Auth Tokens')}</a></li>
31 <li class="${'active' if c.active=='auth_tokens' else ''}"><a href="${h.url('my_account_auth_tokens')}">${_('Auth Tokens')}</a></li>
32 ## TODO: Find a better integration of oauth views into navigation.
32 ## TODO: Find a better integration of oauth views into navigation.
33 %try:
33 <% my_account_oauth_url = h.route_path_or_none('my_account_oauth') %>
34 <li class="${'active' if c.active=='oauth' else ''}"><a href="${h.route_path('my_account_oauth')}">${_('OAuth Identities')}</a></li>
34 % if my_account_oauth_url:
35 %except KeyError:
35 <li class="${'active' if c.active=='oauth' else ''}"><a href="${my_account_oauth_url}">${_('OAuth Identities')}</a></li>
36 %endtry
36 % endif
37 <li class="${'active' if c.active=='emails' else ''}"><a href="${h.url('my_account_emails')}">${_('My Emails')}</a></li>
37 <li class="${'active' if c.active=='emails' else ''}"><a href="${h.url('my_account_emails')}">${_('My Emails')}</a></li>
38 <li class="${'active' if c.active=='repos' else ''}"><a href="${h.url('my_account_repos')}">${_('My Repositories')}</a></li>
38 <li class="${'active' if c.active=='repos' else ''}"><a href="${h.url('my_account_repos')}">${_('My Repositories')}</a></li>
39 <li class="${'active' if c.active=='watched' else ''}"><a href="${h.url('my_account_watched')}">${_('Watched')}</a></li>
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