From 7056f0691a6bdbdffd618cc875b9a84ba83339c5 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 22 Aug 2018 22:54:04 -0400 Subject: [PATCH] Move Link class condition testing to its original location and revert the optimization. Signed-off-by: Roberto Rosario --- mayan/apps/navigation/classes.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mayan/apps/navigation/classes.py b/mayan/apps/navigation/classes.py index a749e75c5a..4e34aa389d 100644 --- a/mayan/apps/navigation/classes.py +++ b/mayan/apps/navigation/classes.py @@ -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)