plone.app.widgets/thet-reloptsfix: Allow related items options to work on non OFS Simple Item o

Johannes Raggam <jenkins-z4DKO/[email protected]> Thu, 27 Jul 2017 14:24:24 -0700 (PDT)
Newsgroups gmane.comp.web.zope.plone.cvs
Message-ID <[email protected]>
Repository: plone.app.widgets
Branch: refs/heads/thet-reloptsfix
Date: 2017-07-27T23:24:01+02:00
Author: Johannes Raggam (thet) <[email protected]>
Commit: https://github.com/plone/plone.app.widgets/commit/e5e4f45511ac0fa4f0c2a3867dc5a92d418cf24a

Allow related items options to work on non OFS Simple Item objects.

Files changed:
M CHANGES.rst
M plone/app/widgets/utils.py

diff --git a/CHANGES.rst b/CHANGES.rst
index c210eab..9368ce6 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -14,7 +14,8 @@ New features:
 
 Bug fixes:
 
-- *add item here*
+- Allow related items options to work on non OFS Simple Item objects.
+  [thet]
 
 
 2.2 (2017-07-03)
diff --git a/plone/app/widgets/utils.py b/plone/app/widgets/utils.py
index 4e94769..81f5ebf 100644
--- a/plone/app/widgets/utils.py
+++ b/plone/app/widgets/utils.py
@@ -142,6 +142,9 @@ def get_relateditems_options(context, value, separator, vocabulary_name,
 
     nav_root = getNavigationRootObject(context, site)
 
+    if not ISimpleItem.providedBy(context):
+        context = nav_root
+
     # basePath - start to search/browse in here.
     base_path_context = context
     if not IFolder.providedBy(base_path_context):



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot