pass brains to IContentListingObject() (#4094)
This commit is contained in:
parent
4703556bbe
commit
1403af59ce
|
@ -8,6 +8,7 @@ from zc.relation.interfaces import ICatalog
|
||||||
from zope.app.intid.interfaces import IIntIds
|
from zope.app.intid.interfaces import IIntIds
|
||||||
|
|
||||||
from plone.dexterity.content import Container
|
from plone.dexterity.content import Container
|
||||||
|
from plone.uuid.interfaces import IUUID
|
||||||
|
|
||||||
from Acquisition import aq_parent
|
from Acquisition import aq_parent
|
||||||
|
|
||||||
|
@ -82,6 +83,7 @@ class Folder(Container):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
children = []
|
children = []
|
||||||
|
uuids = []
|
||||||
sm = getSecurityManager()
|
sm = getSecurityManager()
|
||||||
for item in intid_catalog.findRelations({
|
for item in intid_catalog.findRelations({
|
||||||
'to_id': intid,
|
'to_id': intid,
|
||||||
|
@ -95,9 +97,12 @@ class Folder(Container):
|
||||||
|
|
||||||
document = aq_parent(link)
|
document = aq_parent(link)
|
||||||
if IFolder.providedBy(document):
|
if IFolder.providedBy(document):
|
||||||
children.append(IContentListingObject(document))
|
uuids.append(IUUID(document))
|
||||||
|
|
||||||
return children
|
portal_catalog = api.portal.get_tool('portal_catalog')
|
||||||
|
children = portal_catalog.searchResults({'UID': uuids})
|
||||||
|
|
||||||
|
return [IContentListingObject(x) for x in children]
|
||||||
|
|
||||||
grok.templatedir('templates')
|
grok.templatedir('templates')
|
||||||
grok.context(IDexterityContainer)
|
grok.context(IDexterityContainer)
|
||||||
|
@ -124,7 +129,7 @@ class ClassifiedItems:
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
documents = []
|
uuids = []
|
||||||
sm = getSecurityManager()
|
sm = getSecurityManager()
|
||||||
for item in intid_catalog.findRelations({
|
for item in intid_catalog.findRelations({
|
||||||
'to_id': intid,
|
'to_id': intid,
|
||||||
|
@ -137,10 +142,12 @@ class ClassifiedItems:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
document = aq_parent(link)
|
document = aq_parent(link)
|
||||||
documents.append(IContentListingObject(document))
|
uuids.append(IUUID(document))
|
||||||
|
|
||||||
return documents
|
portal_catalog = api.portal.get_tool('portal_catalog')
|
||||||
|
children = portal_catalog.searchResults({'UID': uuids})
|
||||||
|
|
||||||
|
return [IContentListingObject(x) for x in children]
|
||||||
|
|
||||||
|
|
||||||
class FolderViewlet(grok.Viewlet, ClassifiedItems):
|
class FolderViewlet(grok.Viewlet, ClassifiedItems):
|
||||||
|
|
Reference in New Issue