Back to index

plone3  3.1.7
getEventString.py
Go to the documentation of this file.
00001 ##parameters=event
00002 
00003 context.plone_log("The getEventString script is deprecated and will be "
00004                   "removed in Plone 4.0.")
00005 
00006 from Products.CMFCore.utils import getToolByName
00007 from Products.CMFPlone.utils import safe_unicode
00008 
00009 start = event['start'] and ':'.join(event['start'].split(':')[:2]) or ''
00010 end = event['end'] and ':'.join(event['end'].split(':')[:2]) or ''
00011 title = safe_unicode(event['title']) or 'event'
00012 
00013 if start and end:
00014     eventstring = "%s-%s %s" % (start, end, title)
00015 elif start: # can assume not event['end']
00016     eventstring = "%s - %s" % (start, title)
00017 elif event['end']: # can assume not event['start']
00018     eventstring = "%s - %s" % (title, end)
00019 else: # can assume not event['start'] and not event['end']
00020     eventstring = title
00021 
00022 return eventstring