plone / plone.app.contentlisting

Generic way to make listings of Plone content
2 stars 8 forks source link

@@folderlisting (browser.py) uses control panel "Search" @@search-controlpanel types_not_searched #40

Open yurj opened 3 years ago

yurj commented 3 years ago

Hi!

how to reproduce:

  1. go to @@search-controlpanel
  2. remove some content type
  3. create a folder
  4. add some content, removed in 2.
  5. the folder listing view says "There are currently no items in this folder."

the folder_listing shouldn't always list all content?

The problem is that, by default, portal_type kw is injected with the values from @@search-controlpanel types_not_searched

class FolderListing(BrowserView):

    def __call__(self, batch=False, b_size=20, b_start=0, orphan=0, **kw):
        query = {}
        query.update(kw) <- here

I think the problem is in browser/folder.py

        kwargs.update(self.request.get('contentFilter', {}))
        if 'object_provides' not in kwargs:  # object_provides is more specific
            kwargs.setdefault('portal_type', self.friendly_types)

friendly_types cames from portal and are set in plone/app/layout/globals/portal.py:

    @memoize_contextless
    def friendly_types(self):
        context = aq_inner(self.context)
        registry = getUtility(IRegistry)
        settings = registry.forInterface(ISearchSchema, prefix="plone")
        not_searched = settings.types_not_searched <- here

        types = getToolByName(context, "portal_types").listContentTypes()
        return [t for t in types if t not in not_searched]

I don't know where is should be solved if here or in plone.app.layout