コード例 #1
0
    def iter_bookings(self, idList, categ_id=None):
        for vsid in idList:
            if vsid not in self.ID_TO_IDX:
                continue

            if vsid in ['webcast', 'recording']:
                idx = Catalog.getIdx('cs_booking_instance')[
                    self.ID_TO_IDX[vsid]]
                for __, bkw in idx.iter_bookings(self._fromDT, self._toDT):
                    yield bkw
            else:
                idx = IndexesHolder().getById('collaboration')
                dateFormat = '%d/%m/%Y'

                tempBookings = idx.getBookings(self.ID_TO_IDX[vsid],
                                               "conferenceStartDate",
                                               self._orderBy, self._fromDT,
                                               self._toDT, 'UTC', False, None,
                                               categ_id, False,
                                               dateFormat).getResults()

                for evt, bks in tempBookings:
                    for bk in bks:
                        bk._conf = evt  # Ensure all CSBookings are aware of their Conference
                        yield bk
コード例 #2
0
ファイル: http_api.py プロジェクト: arturodr/indico
    def iter_bookings(self, idList, categ_id=None):
        for vsid in idList:
            if vsid in ["webcast", "recording"]:
                idx = Catalog.getIdx("cs_booking_instance")[self.ID_TO_IDX[vsid]]
                for __, bkw in idx.iter_bookings(self._fromDT, self._toDT):
                    yield bkw
            else:
                idx = IndexesHolder().getById("collaboration")
                dateFormat = "%d/%m/%Y"

                tempBookings = idx.getBookings(
                    self.ID_TO_IDX[vsid],
                    "conferenceStartDate",
                    self._orderBy,
                    self._fromDT,
                    self._toDT,
                    "UTC",
                    False,
                    None,
                    categ_id,
                    False,
                    dateFormat,
                ).getResults()

                for evt, bks in tempBookings:
                    for bk in bks:
                        bk._conf = evt  # Ensure all CSBookings are aware of their Conference
                        yield bk
コード例 #3
0
ファイル: http_api.py プロジェクト: aninhalacerda/indico
    def video(self, idList, alarm = None):

        idx = IndexesHolder().getById('collaboration');
        bookings = []
        dateFormat = '%d/%m/%Y'
        self._alarm = alarm

        for vsid in idList:
            tempBookings = idx.getBookings(self.ID_TO_IDX[vsid], "conferenceStartDate",
                                           self._orderBy, self._fromDT, self._toDT,
                                           'UTC', False, None, None, False, dateFormat)
            bookings.extend(tempBookings.getResults())

        def _iter_bookings(objs):
            for obj in objs:
                for bk in obj[1]:
                    bk._conf = obj[0] # Ensure all CSBookings are aware of their Conference

                    """ This is for plugins whose structure include 'talkSelected',
                        examples of which in CERN Indico being WebcastRequest and
                        RecordingRequest.
                    """
                    if bk.hasTalkSelection():
                        ts = bk.getTalkSelectionList()
                        contributions = []

                        if ts is None: # No individual talks, therefore an event for every contribution
                            contributions = bk._conf.getContributionList()
                        else:
                            for contribId in ts:
                                tempContrib = bk._conf.getContributionById(contribId)
                                contributions.append(tempContrib)

                        if len(contributions) == 0 or self._detail == "event": # If we are here, no contributions but a request exists.
                            bk.setStartDate(bk._conf.getStartDate())
                            bk.setEndDate(bk._conf.getEndDate())
                            yield bk
                        else: # Contributions is the list of all to be exported now
                            contributions = filter(lambda c: c.isScheduled(), contributions)
                            for contrib in contributions:
                                # Wrap the CSBooking object for export
                                bkw = CSBookingContributionWrapper(bk, contrib)
                                bkw.setStartDate(contrib.getStartDate())
                                bkw.setEndDate(contrib.getEndDate())

                                yield bkw
                    else:
                        yield bk

        """ Simple filter, as this method can return None for Pending and True
            for accepted, both are valid booking statuses for exporting.
        """
        def _filter(obj):
            return obj.getAcceptRejectStatus() is not False

        iface = self.DETAIL_INTERFACES.get('all')

        for booking in self._process(_iter_bookings(bookings), _filter, iface):
            yield booking
コード例 #4
0
ファイル: components.py プロジェクト: VishrutMehta/indico
    def initialize(self, dbi=None):
        # empty tree
        self.clear()

        idx = IndexesHolder().getById('collaboration')

        for conf, bks in idx.getBookings(self.index_name, 'conferenceStartDate', None, None, None).getResults():
            for bk in bks:
                self.index_booking(bk)
コード例 #5
0
    def initialize(self, dbi=None):
        # empty tree
        self.clear()

        idx = IndexesHolder().getById('collaboration')

        for _, bks in idx.getBookings(self.index_name, 'conferenceStartDate', None, None, None).getResults():
            for bk in bks:
                self.index_booking(bk)
コード例 #6
0
ファイル: services.py プロジェクト: Ictp/indico
 def _getAnswer(self):
     ci = IndexesHolder().getById('collaboration')
     return ci.getBookings(self._indexName,
                           self._viewBy,
                           self._orderBy,
                           self._minKey,
                           self._maxKey,
                           tz = self._tz,
                           onlyPending = self._onlyPending,
                           conferenceId = self._conferenceId,
                           categoryId = self._categoryId,
                           pickle = True,
                           dateFormat='%a %d %b %Y',
                           page = self._page,
                           resultsPerPage = self._resultsPerPage,
                           grouped=True)
コード例 #7
0
 def _getAnswer(self):
     ci = IndexesHolder().getById('collaboration')
     return ci.getBookings(self._indexName,
                           self._viewBy,
                           self._orderBy,
                           self._minKey,
                           self._maxKey,
                           tz=self._tz,
                           onlyPending=self._onlyPending,
                           conferenceId=self._conferenceId,
                           categoryId=self._categoryId,
                           pickle=True,
                           dateFormat='%a %d %b %Y',
                           page=self._page,
                           resultsPerPage=self._resultsPerPage,
                           grouped=True)
コード例 #8
0
ファイル: http_api.py プロジェクト: pedrogaudencio/indico
    def iter_bookings(self, idList, categ_id=None):
        for vsid in idList:
            if vsid not in self.ID_TO_IDX:
                continue

            if vsid in ['webcast', 'recording']:
                idx = Catalog.getIdx('cs_booking_instance')[self.ID_TO_IDX[vsid]]
                for __, bkw in idx.iter_bookings(self._fromDT, self._toDT):
                    yield bkw
            else:
                idx = IndexesHolder().getById('collaboration');
                dateFormat = '%d/%m/%Y'

                tempBookings = idx.getBookings(self.ID_TO_IDX[vsid], "conferenceStartDate",
                                               self._orderBy, self._fromDT, self._toDT,
                                               'UTC', False, None, categ_id, False, dateFormat).getResults()

                for evt, bks in tempBookings:
                    for bk in bks:
                        bk._conf = evt # Ensure all CSBookings are aware of their Conference
                        yield bk