Пример #1
0
    def _process(self):
        form = RequestListFilterForm(request.args, csrf_enabled=False)
        results = None
        if request.args and form.validate():
            reverse = form.direction.data == 'desc'
            talks = form.granularity.data == 'talks'
            from_dt = as_utc(get_day_start(
                form.start_date.data)) if form.start_date.data else None
            to_dt = as_utc(get_day_end(
                form.end_date.data)) if form.end_date.data else None
            states = {form.state.data} if form.state.data is not None else None
            results = find_requests(talks=talks,
                                    from_dt=from_dt,
                                    to_dt=to_dt,
                                    states=states)
            if not talks:
                results = [(req, req.event, req.event.start_dt)
                           for req in results]
            results = group_list(results,
                                 lambda x: x[2].date(),
                                 itemgetter(2),
                                 sort_reverse=reverse)
            results = OrderedDict(
                sorted(results.viewitems(), key=itemgetter(0),
                       reverse=reverse))

        return WPAudiovisualManagers.render_template('request_list.html',
                                                     form=form,
                                                     results=results)
Пример #2
0
 def export_webcast_recording(self, user):
     results = find_requests(talks=True,
                             from_dt=self._fromDT,
                             to_dt=self._toDT,
                             services=self._services,
                             states=(RequestState.accepted,
                                     RequestState.pending))
     for req, contrib, _ in results:
         yield _serialize_obj(req, contrib, self._alarm)