diff --git a/mayan/apps/common/urls.py b/mayan/apps/common/urls.py index e4acb6c941..79195b4f70 100644 --- a/mayan/apps/common/urls.py +++ b/mayan/apps/common/urls.py @@ -4,7 +4,7 @@ from django.conf.urls import patterns, url from django.contrib.staticfiles.templatetags.staticfiles import static from django.views.generic import RedirectView -from .views import AboutView +from .views import AboutView, ToolsListView urlpatterns = patterns('common.views', @@ -22,7 +22,7 @@ urlpatterns = patterns('common.views', url(r'^user/locale/edit/$', 'current_user_locale_profile_edit', (), name='current_user_locale_profile_edit'), url(r'^setup/$', 'setup_list', (), 'setup_list'), - url(r'^tools/$', 'tools_list', (), 'tools_list'), + url(r'^tools/$', ToolsListView.as_view(), name='tools_list'), ) urlpatterns += patterns('', diff --git a/mayan/apps/common/views.py b/mayan/apps/common/views.py index ff2341d1e5..ce73d5c8c8 100644 --- a/mayan/apps/common/views.py +++ b/mayan/apps/common/views.py @@ -429,14 +429,16 @@ def setup_list(request): context_instance=RequestContext(request)) -def tools_list(request): - context = { - 'object_navigation_links': menu_tools.resolve(context=RequestContext(request)), - 'title': _('Tools'), - } +class ToolsListView(TemplateView): + template_name = 'appearance/generic_list_horizontal.html' - return render_to_response('appearance/generic_list_horizontal.html', context, - context_instance=RequestContext(request)) + def get_context_data(self, **kwargs): + data = super(ToolsListView, self).get_context_data(**kwargs) + data.update({ + 'object_navigation_links': menu_tools.resolve(context=RequestContext(self.request)), + 'title': _('Tools'), + }) + return data def home(request): diff --git a/mayan/apps/navigation/classes.py b/mayan/apps/navigation/classes.py index 0808a1a197..dbb6e4fae2 100644 --- a/mayan/apps/navigation/classes.py +++ b/mayan/apps/navigation/classes.py @@ -92,9 +92,7 @@ class Menu(object): resolved_link = link.resolve(context=context, resolved_object=resolved_navigation_object) if resolved_link: result.append(resolved_link) - #break # No need for further content object match testing - # TODO: profile this - + break # No need for further content object match testing except TypeError: # When source is a dictionary pass @@ -138,11 +136,6 @@ class Link(object): current_path = request.META['PATH_INFO'] current_view = resolve(current_path).view_name - # Preserve unicode data in URL query - previous_path = smart_unicode(urllib.unquote_plus(smart_str(request.get_full_path()) or smart_str(request.META.get('HTTP_REFERER', reverse(settings.LOGIN_REDIRECT_URL))))) - query_string = urlparse.urlparse(previous_path).query - parsed_query_string = urlparse.parse_qs(query_string) - # If this link has a required permission check that the user have it # too if self.permissions: @@ -201,6 +194,10 @@ class Link(object): # Lets a new link keep the same URL query string of the current URL if self.keep_query: # Sometimes we are required to remove a key from the URL QS + previous_path = smart_unicode(urllib.unquote_plus(smart_str(request.get_full_path()) or smart_str(request.META.get('HTTP_REFERER', reverse(settings.LOGIN_REDIRECT_URL))))) + query_string = urlparse.urlparse(previous_path).query + parsed_query_string = urlparse.parse_qs(query_string) + for key in self.remove_from_query: try: del parsed_query_string[key]