Properly initialize ResolvedLink class
This commit is contained in:
@@ -8,8 +8,8 @@ import re
|
|||||||
from django.template import (VariableDoesNotExist, Variable)
|
from django.template import (VariableDoesNotExist, Variable)
|
||||||
from django.utils.encoding import smart_str, smart_unicode
|
from django.utils.encoding import smart_str, smart_unicode
|
||||||
from django.core.urlresolvers import reverse, NoReverseMatch
|
from django.core.urlresolvers import reverse, NoReverseMatch
|
||||||
from django.utils.http import urlquote
|
from django.utils.http import urlquote, urlencode
|
||||||
from django.utils.http import urlencode
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from elementtree.ElementTree import SubElement
|
from elementtree.ElementTree import SubElement
|
||||||
|
|
||||||
@@ -28,6 +28,8 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class ResolvedLink(object):
|
class ResolvedLink(object):
|
||||||
active = False
|
active = False
|
||||||
|
url = '#'
|
||||||
|
text = _('Unnamed link')
|
||||||
|
|
||||||
|
|
||||||
class Link(object):
|
class Link(object):
|
||||||
@@ -67,12 +69,16 @@ class Link(object):
|
|||||||
query_string = urlparse.urlparse(previous_path).query
|
query_string = urlparse.urlparse(previous_path).query
|
||||||
parsed_query_string = urlparse.parse_qs(query_string)
|
parsed_query_string = urlparse.parse_qs(query_string)
|
||||||
|
|
||||||
|
logger.debug('condition: %s', self.condition)
|
||||||
|
|
||||||
# Check to see if link has conditional display
|
# Check to see if link has conditional display
|
||||||
if self.condition:
|
if self.condition:
|
||||||
condition_result = self.condition(context)
|
condition_result = self.condition(context)
|
||||||
else:
|
else:
|
||||||
condition_result = True
|
condition_result = True
|
||||||
|
|
||||||
|
logger.debug('condition_result: %s', condition_result)
|
||||||
|
|
||||||
if condition_result:
|
if condition_result:
|
||||||
resolved_link = ResolvedLink()
|
resolved_link = ResolvedLink()
|
||||||
resolved_link.text = self.text
|
resolved_link.text = self.text
|
||||||
|
|||||||
Reference in New Issue
Block a user