Backport trash can navigation link resolution fix, GitLab issue #331. Thanks to @DocCyblade for the report.

This commit is contained in:
Roberto Rosario
2016-11-08 02:13:18 -04:00
parent 4222035cc1
commit 14bde36c1f
3 changed files with 15 additions and 13 deletions

View File

@@ -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,