Changeset 77384a in indico


Ignore:
Timestamp:
02/02/12 17:55:32 (16 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:
1d5dc6
Parents:
4ea669
git-author:
Alberto Resco Perez <alberto.resco.perez@…> (01/12/12 14:59:19)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (02/02/12 17:55:32)
Message:

[FIX] Fix previous commit

  • Moved the fossil to fossils.py.
  • Moved the utils methods in http_apy to collaborationTools.py
  • Fossilizing getTitle takes into account if linked to contribution or session in vidyo bookings.
  • Fossilizing status fixed.
Location:
indico
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/conference.py

    ra554f5 r77384a  
    69526952        return self.title 
    69536953 
     6954    def getFullTitle( self ): 
     6955        return self.getSession().getTitle() + (": " + self.getTitle() if self.getTitle() else "") 
     6956 
    69546957    def getName(self): 
    69556958        return "slot %s"%self.getId() 
  • indico/MaKaC/plugins/Collaboration/Vidyo/collaboration.py

    r168125 r77384a  
    3434from MaKaC.common.externalOperationsManager import ExternalOperationsManager 
    3535from MaKaC.plugins.Collaboration.Vidyo.pages import ServiceInformation 
     36from MaKaC.conference import Contribution, Session 
    3637 
    3738class CSBooking(CSBookingBase): 
     
    274275            if linkObject is None: 
    275276                return _("Removed %s")%_("contribution") if self.isLinkedToContribution() else _("session") 
    276             if self.isLinkedToContribution(): 
     277            if self.isLinkedToContribution() and isinstance(linkObject, Contribution): 
    277278                title = linkObject.getTitle() 
     279                linkVideoText = title + " (" + self._linkVideoType + ")" 
     280            elif self.isLinkedToSession() and isinstance(linkObject, Session): 
     281                title = linkObject.getSession().getTitle() + (" - " + linkObject.getTitle() if linkObject.getTitle() else "") 
     282                linkVideoText = title + " (" + self._linkVideoType + ")" 
    278283            else: 
    279                 title = linkObject.getSession().getTitle() + (" - " + linkObject.getTitle() if linkObject.getTitle() else "") 
    280             linkVideoText = title + " (" + self._linkVideoType + ")" 
     284                linkVideoText = _("Link removed") 
    281285        else: 
    282286            linkVideoText = _("Whole event") 
  • indico/MaKaC/plugins/Collaboration/collaborationTools.py

    rdc366d r77384a  
    353353        return requestType 
    354354 
     355    """ The CSBooking object which can be passed through to the fossil 
     356        may be linked to a Contribution, in the case of WebcastRequest etc, 
     357        therefore the URL may be more specific than the event in this instance. 
     358    """ 
     359 
     360    @classmethod 
     361    def getConferenceOrContributionURL(cls, event): 
     362        from MaKaC.webinterface.urlHandlers import UHConferenceDisplay, UHContributionDisplay 
     363        url = "" 
     364 
     365        # Webcast and Recording Request specific: 
     366        if hasattr(event, '_conf'): 
     367            event = event._conf 
     368 
     369        if isinstance(event, Conference): 
     370            url = UHConferenceDisplay.getURL(event) 
     371        elif isinstance(event, Contribution): 
     372            url = UHContributionDisplay(event) 
     373 
     374        return url 
     375 
     376    @classmethod 
     377    def getBookingTitle(cls, booking): 
     378        title = "" 
     379        if hasattr(booking, 'getFullTitle'): 
     380            title = booking.getFullTitle() 
     381        elif hasattr(booking, 'getTitle'): 
     382            title = booking.getTitle() 
     383        elif hasattr(booking, '_getTitle'): 
     384            title = booking._getTitle() 
     385        elif hasattr(booking, '_conf'): 
     386            title = booking._conf.getTitle() 
     387 
     388        return title if title is not None else 'No title defined.' 
     389 
    355390class MailTools(object): 
    356391 
  • indico/MaKaC/plugins/Collaboration/fossils.py

    rc53d5c r77384a  
    3030from MaKaC.fossils.conference import IConferenceFossil 
    3131from MaKaC.common.Conversion import Conversion 
     32from MaKaC.plugins import Collaboration 
    3233 
    3334 
     
    237238    def getNPages(self): 
    238239        pass 
     240 
     241""" MetadataFossil created for use with iCal serialisation of Collaboration / 
     242    VideoService events. 
     243""" 
     244class ICollaborationMetadataFossil(IFossil): 
     245 
     246    def getStartDateAsString(self): 
     247        pass 
     248 
     249    def getAcceptRejectStatus(self): 
     250        pass 
     251    getAcceptRejectStatus.produce = lambda s: 'Pending' if s.getAcceptRejectStatus() is None else 'Accepted' 
     252    getAcceptRejectStatus.name = 'status' 
     253 
     254    def getStartDate(self): 
     255        pass 
     256 
     257    def getEndDate(self): 
     258        pass 
     259 
     260    def _getTitle(self): 
     261        pass 
     262 
     263    _getTitle.produce = lambda s: Collaboration.collaborationTools.CollaborationTools.getBookingTitle(s.getLinkObject() if s.hasSessionOrContributionLink() else s._conf) 
     264    _getTitle.name = 'title' 
     265 
     266    def getType(self): 
     267        pass 
     268 
     269    def getUniqueId(self): 
     270        pass 
     271 
     272    def getURL(self): 
     273        pass 
     274    getURL.produce = lambda s: Collaboration.collaborationTools.CollaborationTools.getConferenceOrContributionURL(s) 
     275    getURL.name = 'url' 
  • indico/MaKaC/plugins/Collaboration/http_api.py

    r4ea669 r77384a  
    2828from MaKaC.common.indexes import IndexesHolder 
    2929from MaKaC.plugins.Collaboration.RecordingManager.common import createIndicoLink 
    30 from MaKaC.plugins.Collaboration.pages import WElectronicAgreement 
    3130from MaKaC.plugins.Collaboration.collaborationTools import CollaborationTools 
    3231from MaKaC.conference import ConferenceHolder 
    3332from MaKaC.plugins.Collaboration.base import SpeakerStatusEnum 
     33from MaKaC.plugins.Collaboration.fossils import ICollaborationMetadataFossil 
    3434 
    3535 
     
    4949 
    5050    def _getParams(self): 
    51         # import pydevd; pydevd.settrace(stdoutToServer = True, stderrToServer = True) 
    52          
     51 
    5352        super(CollaborationAPIHook, self)._getParams() 
    5453        self._indicoID = get_query_parameter(self._queryParams, ['iid', 'indicoID']) 
     
    105104                } 
    106105 
    107 """ Container for utilitarian tools for use with the Collaboration export API 
    108 """ 
    109 class CollaborationAPIUtils(): 
    110  
    111     """ The CSBooking object which can be passed through to the fossil 
    112         may be linked to a Contribution, in the case of WebcastRequest etc, 
    113         therefore the URL may be more specific than the event in this instance. 
    114     """ 
    115     @staticmethod 
    116     def getConferenceOrContributionURL(event): 
    117         from MaKaC.conference import Conference, Contribution 
    118         from MaKaC.webinterface.urlHandlers import UHConferenceDisplay, UHContributionDisplay 
    119         url = "" 
    120  
    121         # Webcast and Recording Request specific: 
    122         if hasattr(event, '_conf'): 
    123             event = event._conf 
    124  
    125         if isinstance(event, Conference): 
    126             url = UHConferenceDisplay.getURL(event) 
    127         elif isinstance(event, Contribution): 
    128             url = UHContributionDisplay(event) 
    129  
    130         return url 
    131  
    132     @staticmethod 
    133     def getBookingTitle(booking): 
    134         title = "" 
    135         if hasattr(booking, 'getTitle'): 
    136             title = booking.getTitle() 
    137         elif hasattr(booking, '_getTitle'): 
    138             title = booking._getTitle() 
    139         elif hasattr(booking, '_conf'): 
    140             title = booking._conf.getTitle() 
    141  
    142         return title if title is not None else 'No title defined.' 
    143  
    144 """ MetadataFossil created for use with iCal serialisation of Collaboration / 
    145     VideoService events. 
    146 """ 
    147 class ICollaborationMetadataFossil(IFossil): 
    148  
    149     def getStartDateAsString(self): 
    150         pass 
    151  
    152     def getAcceptRejectStatus(self): 
    153         pass 
    154     getAcceptRejectStatus.produce = lambda s: 'Pending' if s is None else 'Accepted' 
    155     getAcceptRejectStatus.name = 'status' 
    156  
    157     def getStartDate(self): 
    158         pass 
    159  
    160     def getEndDate(self): 
    161         pass 
    162  
    163     def _getTitle(self): 
    164         pass 
    165     _getTitle.produce = lambda s: CollaborationAPIUtils.getBookingTitle(s._conf) 
    166     _getTitle.name = 'title' 
    167  
    168     def getType(self): 
    169         pass 
    170  
    171     def getUniqueId(self): 
    172         pass 
    173  
    174     def getURL(self): 
    175         pass 
    176     getURL.produce = lambda s: CollaborationAPIUtils.getConferenceOrContributionURL(s) 
    177     getURL.name = 'url' 
    178106 
    179107""" This has been defined as a separate hook to CollaborationExportHook et al 
     
    241169 
    242170        for id in idList: 
    243             tempBookings = idx.getBookings(self.ID_TO_IDX[id], "conferenceStartDate",  
     171            tempBookings = idx.getBookings(self.ID_TO_IDX[id], "conferenceStartDate", 
    244172                                           self._orderBy, self._fromDT, self._toDT, 
    245173                                           'UTC', False, None, None, False, dateFormat) 
     
    275203                        else: # contributions is the list of all to be exported now 
    276204                            for contrib in contributions: 
    277                                 bk.setStartDate(contrib.getStartDate()) 
    278                                 bk.setEndDate(contrib.getEndDate()) 
     205                                if contrib.isScheduled(): 
     206                                    bk.setStartDate(contrib.getStartDate()) 
     207                                    bk.setEndDate(contrib.getEndDate()) 
     208                                else: 
     209                                    bk.setStartDate(bk._conf.getStartDate()) 
     210                                    bk.setEndDate(bk._conf.getEndDate()) 
    279211                                yield bk 
    280212 
  • indico/web/http_api/api.py

    r4ea669 r77384a  
    521521        return self._process(_iterate_objs(idlist)) 
    522522 
    523  
    524523Serializer.register('html', HTML4Serializer) 
    525524Serializer.register('jsonp', JSONPSerializer) 
  • indico/web/http_api/fossils.py

    r4ea669 r77384a  
    321321    getContributionListWithoutSessions.result = IContributionMetadataWithSubContribsFossil 
    322322    getContributionListWithoutSessions.name = 'contributions' 
    323  
    324  
    325  
    326  
  • indico/web/http_api/ical.py

    r4ea669 r77384a  
    137137        cal.set('version', '2.0') 
    138138        cal.set('prodid', '-//CERN//INDICO//EN') 
    139  
    140139        now = datetime.datetime.utcnow() 
    141140        for fossil in results: 
Note: See TracChangeset for help on using the changeset viewer.