From 14bde36c1ffd6dbea4d5d9edb7acfcf2967a730f Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 8 Nov 2016 02:13:18 -0400 Subject: [PATCH] Backport trash can navigation link resolution fix, GitLab issue #331. Thanks to @DocCyblade for the report. --- HISTORY.rst | 2 +- docs/releases/2.1.5.rst | 2 ++ mayan/apps/navigation/classes.py | 24 ++++++++++++------------ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index e3cfdcedb3..e6785dd476 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,7 +3,7 @@ - Backport resize transformation math operation fix (GitLab #319). - Update Pillow to 3.1.2 (Security fix). - Backport zoom transformation performance improvement (GitLab #334). - +- Backport trash can navigation link resolution fix (GitLab #331). 2.1.4 (2016-10-28) ================== diff --git a/docs/releases/2.1.5.rst b/docs/releases/2.1.5.rst index 015bc9a9b9..474d7f76b6 100644 --- a/docs/releases/2.1.5.rst +++ b/docs/releases/2.1.5.rst @@ -19,6 +19,7 @@ Other changes - https://pillow.readthedocs.io/en/3.4.x/releasenotes/3.1.2.html - Backport zoom performance improvement (GitLab #334). +- Backport trash can navigation link resolution fix (GitLab #331). Removals @@ -75,6 +76,7 @@ Bugs fixed or issues closed =========================== * `GitLab issue #319 `_ TransformationResize issue with very "long" image +* `GitLab issue #331 `_ Trash List View: Items actions should be limited * `GitLab issue #334 `_ Perfomance improvment: prevent unnecessary image.resize in TransformationZoom .. _PyPI: https://pypi.python.org/pypi/mayan-edms/ diff --git a/mayan/apps/navigation/classes.py b/mayan/apps/navigation/classes.py index 2d45129369..492c6de810 100644 --- a/mayan/apps/navigation/classes.py +++ b/mayan/apps/navigation/classes.py @@ -126,19 +126,19 @@ class Menu(object): for bound_source, links in self.bound_links.iteritems(): try: - if inspect.isclass(bound_source) and type(resolved_navigation_object) == bound_source: - for link in links: - resolved_link = link.resolve( - context=context, - resolved_object=resolved_navigation_object - ) - if resolved_link: - resolved_links.append(resolved_link) - # No need for further content object match testing - break - else: + if inspect.isclass(bound_source): + if type(resolved_navigation_object) == bound_source: + for link in links: + resolved_link = link.resolve( + context=context, + resolved_object=resolved_navigation_object + ) + if resolved_link: + resolved_links.append(resolved_link) + # No need for further content object match testing + break + elif hasattr(resolved_navigation_object, 'get_deferred_fields') and resolved_navigation_object.get_deferred_fields() and isinstance(resolved_navigation_object, bound_source): # Second try for objects using .defer() or .only() - if inspect.isclass(bound_source) and isinstance(resolved_navigation_object, bound_source): for link in links: resolved_link = link.resolve( context=context,