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:
Roberto Rosario
2018-08-22 22:54:04 -04:00
parent 5c015ccdc3
commit 7056f0691a

View File

@@ -339,6 +339,13 @@ class Link(object):
except PermissionDenied:
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)
if self.view:
@@ -378,13 +385,6 @@ class Link(object):
elif 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
if self.conditional_disable:
resolved_link.disabled = self.conditional_disable(context)