Back to index

plone3  3.1.7
recent.py
Go to the documentation of this file.
00001 from Acquisition import aq_inner
00002 import zope.deprecation
00003 from zope.interface import implements
00004 
00005 from Products.Five import BrowserView
00006 from Products.CMFCore.utils import getToolByName
00007 from Products.CMFPlone.browser.interfaces import IRecentPortlet
00008 
00009 
00010 class RecentPortlet(BrowserView):
00011     implements(IRecentPortlet)
00012 
00013     def results(self):
00014         """ """
00015         context = aq_inner(self.context)
00016         putils = getToolByName(context, 'plone_utils')
00017         portal_catalog = getToolByName(context, 'portal_catalog')
00018         typesToShow = putils.getUserFriendlyTypes()
00019         return self.request.get(
00020             'items',
00021             portal_catalog.searchResults(sort_on='modified',
00022                                          portal_type=typesToShow,
00023                                          sort_order='reverse',
00024                                          sort_limit=5)[:5])
00025 
00026 zope.deprecation.deprecated(
00027   ('RecentPortlet', ),
00028    "Plone's portlets are based on plone.app.portlets now. The old portlets "
00029    "will be removed in Plone 4.0."
00030   )