clearly either the portlet context for the @@fileUpload view is wrong, or the view needs to be registered more broadly.
Not sure if this is a know issue? If not, I will file a bug report - where do I do this, in the github issue tracker for plone/Products.CMFPlone ?
I can work on a fix if I get some guidance to what the best solution is - is this a general problem in the portlet rich text field context, or should it be handled in the @@fileUpload view?
My guess is this also affects other cases where a tinymce widget is used on non-content objects (mosaic? not sure about the architecture here).
I did update the GithHub issue to note that I could reproduce it.
In the meantime, here is a workaround that I just implemented for a project. It overrides the fileUpload view to make it available to all interfaces, and adds a custom __init__ to make sure we get a folderish item.
from OFS.interfaces import IFolder
from plone.app.content.browser.file import FileUploadView
class FileUploadViewFix(FileUploadView):
"""FileUploadView available for all interfaces.
If context is not folderish, get the parent
"""
def __init__(self, context, request):
if IFolder.providedBy(context):
self.context = context
else:
for loc in context.aq_chain:
if IFolder.providedBy(loc):
self.context = loc
break
self.request = request