Back to index

plone3  3.1.7
news_box.py
Go to the documentation of this file.
00001 ##parameters=
00002 ##
00003 from ZTUtils import Batch
00004 from Products.CMFCore.utils import getToolByName
00005 from Products.CMFDefault.utils import decode
00006 
00007 ctool = getToolByName(script, 'portal_catalog')
00008 
00009 options = {}
00010 
00011 items = ctool.searchResults(portal_type='News Item', sort_on='Date',
00012                             sort_order='reverse', review_state='published')
00013 batch_obj = Batch(items, 10, 0, orphan=1)
00014 items = [ {'title': item.Title,
00015            'date': item.Date,
00016            'url': item.getURL()}
00017           for item in batch_obj ]
00018 options['listItemInfos'] = items
00019 
00020 return context.news_box_template(**decode(options, script))