Move Link class condition testing to its original location and revert the optimization.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -339,6 +339,13 @@ class Link(object):
|
|||||||
except PermissionDenied:
|
except PermissionDenied:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# Check to see if link has conditional display function and only
|
||||||
|
# display it if the result of the conditional display function is
|
||||||
|
# True
|
||||||
|
if self.condition:
|
||||||
|
if not self.condition(context):
|
||||||
|
return None
|
||||||
|
|
||||||
resolved_link = ResolvedLink(current_view=current_view, link=self)
|
resolved_link = ResolvedLink(current_view=current_view, link=self)
|
||||||
|
|
||||||
if self.view:
|
if self.view:
|
||||||
@@ -378,13 +385,6 @@ class Link(object):
|
|||||||
elif self.url:
|
elif self.url:
|
||||||
resolved_link.url = self.url
|
resolved_link.url = self.url
|
||||||
|
|
||||||
# Check to see if link has conditional display function and only
|
|
||||||
# display it if the result of the conditional display function is
|
|
||||||
# True
|
|
||||||
if self.condition:
|
|
||||||
if not self.condition(context):
|
|
||||||
return None
|
|
||||||
|
|
||||||
# This is for links that should be displayed but that are not clickable
|
# This is for links that should be displayed but that are not clickable
|
||||||
if self.conditional_disable:
|
if self.conditional_disable:
|
||||||
resolved_link.disabled = self.conditional_disable(context)
|
resolved_link.disabled = self.conditional_disable(context)
|
||||||
|
|||||||
Reference in New Issue
Block a user