source: trunk/skins/lemill/find_related_stories.py @ 1705

Revision 1705, 812 bytes checked in by jukka, 13 years ago (diff)

Worked on #1341, spent 4h. Collections and mmedia/presentation/pilotmaterials recognize deleted content and won't show empty instead

or with collections message DELETED next to link. We need placeholder images instead of empty spaces, finish the ticket when agreed
on them.

  • Property svn:eol-style set to native
Line 
1## Script (Python) "find_related_stories.py"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=Finds all related stories
9
10from Products.CMFCore.utils import getToolByName
11portal_catalog = getToolByName( context, 'portal_catalog' )
12# getRawRelatedContent, getRawRelatedTools, getRawRelatedActivities
13var = 'getRawRelatedContent'
14if context.meta_type == 'Activity':
15    var = 'getRawRelatedMethods'
16if context.meta_type == 'Tool':
17    var = 'getRawRelatedTools'
18query = {var:context.UID(),
19    'getGoodStory':True,
20    'meta_type':'Collection',
21    'sort_on': 'Date',
22    'sort_order': 'descending'}
23results = portal_catalog.searchResults(query)
24results = [x for x in results if x.review_state!='deleted']
25return results
Note: See TracBrowser for help on using the repository browser.