Skip to content

Commit

Permalink
almost got working with collections in plone5
Browse files Browse the repository at this point in the history
  • Loading branch information
djay committed Jul 27, 2017
1 parent fab188d commit 995d875
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/collective/listingviews/browser/views/collection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from zope.component import adapts
from zope.browser.interfaces import IBrowserView
from zope.component import adapts, getMultiAdapter, ComponentLookupError
from zope.interface import implements
from Products.CMFCore.utils import getToolByName
from basic import BasicTopicListingInformationRetriever
Expand All @@ -20,6 +21,22 @@ def retrieve_listing_items(self):
are a large number of fields in the view. No need
to wake up all the objects.
"""

# Let's get the browser view for the collection
# and get its' results
# works for plone.app.contenttypes.interfaces.ICollection

try:
view = getMultiAdapter((self.context, self.request), name='listing_view')
view = view.__of__(self.context)

results = view.results()
return results
except ComponentLookupError:
pass

# plone.app.collection
# TODO: should probably use its code directly
limit = self.context.limit
query = queryparser.parseFormquery(self.context,
self.context.getRawQuery())
Expand Down
8 changes: 8 additions & 0 deletions src/collective/listingviews/browser/views/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@
class=".collection.BasicCollectionListingInformationRetriever"
permission="zope2.View"
zcml:condition="installed plone.app.collection"/>

<browser:page
for="plone.app.contenttypes.interfaces.ICollection"
name="listing_view_adapter"
class=".collection.BasicCollectionListingInformationRetriever"
permission="zope2.View"
zcml:condition="installed plone.app.contenttypes"/>

<browser:page
for="*"
name="listing_view_adapter"
Expand Down

0 comments on commit 995d875

Please sign in to comment.