From 3094a940e1aa7fae4998432dc8c958aced31009c Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Fri, 8 Jun 2012 17:11:04 -0400 Subject: [PATCH] Allow passing request, current_path and current_view parameters to Link instances before resolving them --- apps/navigation/api.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/navigation/api.py b/apps/navigation/api.py index efdc441cfa..0a1a35833b 100644 --- a/apps/navigation/api.py +++ b/apps/navigation/api.py @@ -58,11 +58,11 @@ class Link(object): self.children_url_regex = children_url_regex or [] self.children_view_regex = children_view_regex or [] - def resolve(self, context): + def resolve(self, context, request=None, current_path=None, current_view=None): # TODO: don't calculate these if passed in an argument - request = Variable('request').resolve(context) - current_path = request.META['PATH_INFO'] - current_view = resolve_to_name(current_path) + request = request or Variable('request').resolve(context) + current_path = current_path or request.META['PATH_INFO'] + current_view = current_view or resolve_to_name(current_path) # 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', u'/'))))