espenmn
(Espen)
1
In the docs, it says:
In Python a ContentListing of a particular folder's contents can be fetched by using:
>>> path.to.your.folder.restrictedTraverse('@@contentlisting')()
In my case, the path is 'Plone/folder/folder-1', but is it (really) supposed to be working like this? (it does not)
Plone.folder.folder-1.restrictedTraverse("@@contentlisting")()
mekell
(me-kell)
2
Try
Plone.folder["folder-1"].restrictedTraverse("@@contentlisting")()
petschki
(Peter Mathis)
3
you could also use plone.api
folder = api.content.get(path='/folder/folder-1')
listing = api.content.get_view(name="contentlisting", context=folder)
espenmn
(Espen)
4
Thanks, works like a charm.
One note: I got 'not callable error', so my code is now
listing = api.content.get_view(name="contentlisting", context=folder)
2 Likes