Changeset 8ba2f9 in indico


Ignore:
Timestamp:
02/23/12 17:26:18 (15 months ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
12d2c2
Parents:
e3def0
git-author:
Matthew Pugh <matthew.alexander.pugh@…> (02/23/12 15:05:21)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (02/23/12 17:26:18)
Message:

[MIN] VS iCal Ouput: Condensed prefixes

  • Added utils class to iCal export for Collaboration
  • Condenses prefixes to iCal event summaries
File:
1 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/plugins/Collaboration/http_api.py

    r4bd5a7 r8ba2f9  
    4747    alarm.set('trigger', trigger) 
    4848    alarm.set('action', 'DISPLAY') 
    49     alarm.set('summary', "[" + fossil['type'] + "] " + fossil['status'] + " - " + fossil['title'].decode('utf-8')) 
     49    alarm.set('summary', VideoExportUtilities.getCondensedPrefix(fossil['type'], 
     50                                                                 fossil['status']) + fossil['title'].decode('utf-8')) 
    5051    alarm.set('description', str(fossil['url'])) 
    5152 
     
    6263    event.set('url', url) 
    6364    event.set('categories', "VideoService - " + fossil['type']) 
    64     event.set('summary', "[" + fossil['type'] + "] " + fossil['status'] + " - " + fossil['title'].decode('utf-8')) 
     65    event.set('summary', VideoExportUtilities.getCondensedPrefix(fossil['type'], 
     66                                                                 fossil['status']) + fossil['title'].decode('utf-8')) 
    6567    event.set('description', url) 
    6668 
     
    7375# the iCal serializer needs some extra info on how to display things 
    7476ICalSerializer.register_mapper('collaborationMetadata', serialize_collaboration) 
     77 
     78 
     79class VideoExportUtilities(): 
     80 
     81    SERVICE_MAP = { 
     82        'CERNMCU': 'MCU', 
     83        'WebcastRequest': 'W', 
     84        'RecordingRequest': 'R' 
     85    } 
     86    STATUS_MAP = { 
     87        'Accepted': 'A', 
     88        'Rejected': 'R', 
     89        'Pending': 'P' 
     90    } 
     91 
     92    @staticmethod 
     93    def getCondensedPrefix(service, status): 
     94        """ Condense down the summary lines based on the above dictionaries 
     95            for easier reading in calendar applications. 
     96        """ 
     97        prefix = "" 
     98 
     99        if VideoExportUtilities.SERVICE_MAP.has_key(service): 
     100            prefix += VideoExportUtilities.SERVICE_MAP.get(service) 
     101        else: 
     102            prefix += service 
     103 
     104        prefix += '-' 
     105 
     106        if VideoExportUtilities.STATUS_MAP.has_key(status): 
     107            prefix += VideoExportUtilities.STATUS_MAP.get(status) 
     108        else: 
     109            prefix += status 
     110 
     111        return (prefix + ": ") 
    75112 
    76113 
Note: See TracChangeset for help on using the changeset viewer.