How to use indico - 10 common examples

To help you get started, we’ve selected a few indico examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github indico / indico / indico / modules / events / management / controllers / posters.py View on Github external
def _process(self):
        self.commit = False
        form = PosterPrintingForm(self.event, template=self.template_id)
        if form.validate_on_submit():
            data = dict(form.data)
            template_id = data.pop('template')
            key = unicode(uuid.uuid4())
            poster_cache.set(key, data, time=1800)
            download_url = url_for('.print_poster', self.event, template_id=template_id, uuid=key)
            return jsonify_data(flash=False, redirect=download_url, redirect_no_loading=True)
        return jsonify_form(form, disabled_until_change=False, back=_('Cancel'), submit=_('Download PDF'))
github indico / indico / indico / modules / events / registration / controllers / management / regforms.py View on Github external
def _process(self):
        form = RegistrationFormForm()
        if form.validate_on_submit():
            regform = RegistrationForm(event_new=self.event_new)
            create_personal_data_fields(regform)
            form.populate_obj(regform)
            db.session.add(regform)
            db.session.flush()
            flash(_('Registration form has been successfully created'), 'success')
            self.event.log(EventLogRealm.management, EventLogKind.positive, 'Registration',
                           'Registration form "{}" has been created'.format(regform.title), session.user)
            return redirect(url_for('.manage_regform', regform))
        return WPManageRegistration.render_template('management/regform_edit.html', self.event, event=self.event,
                                                    form=form)
github indico / indico / indico / modules / rb / controllers / backend / bookings.py View on Github external
def _process(self):
        q = (ReservationOccurrence.query
             .filter(ReservationOccurrence.start_dt > utc_to_server(now_utc()),
                     ReservationOccurrence.is_valid,
                     db.or_(Reservation.booked_for_user == session.user,
                            Reservation.created_by_user == session.user),
                     ~Room.is_deleted)
             .join(Reservation)
             .join(Room)
             .order_by(ReservationOccurrence.start_dt.asc())
             .limit(5))
        return jsonify(reservation_occurrences_schema.dump(q))
github indico / indico / indico_zodbimport / modules / roombooking.py View on Github external
print cformat('  %{blue!}Aspect:%{reset} {}').format(a.name)

                l.aspects.append(a)
                if old_aspect.defaultOnStartup:
                    l.default_aspect = a

            # add custom attributes
            for ca in custom_attributes_dict.get(l.name, []):
                if ca['type'] != 'str':
                    raise RuntimeError('Non-str custom attributes are unsupported: {}'.format(ca))
                attr_name = attribute_map.get(ca['name'], ca['name'])
                attr = RoomAttribute(name=attr_name.replace(' ', '-').lower(), title=attr_name, type=ca['type'],
                                     is_required=ca['required'], is_hidden=ca['hidden'])
                l.attributes.append(attr)
                print cformat('  %{blue!}Attribute:%{reset} {}').format(attr.title)

            # add new created location
            db.session.add(l)
            print
            print
        db.session.commit()
github indico / indico / indico / modules / events / surveys / controllers / management.py View on Github external
def _process(self):
        form = SurveyForm(obj=FormDefaults(require_user=True), event=self.event)
        if form.validate_on_submit():
            survey = Survey(event_new=self.event.as_event)
            form.populate_obj(survey)
            db.session.add(survey)
            db.session.flush()
            flash(_('Survey created'), 'success')
            logger.info('Survey {} created by {}'.format(survey, session.user))
            return redirect(url_for('.manage_survey', survey))
        return WPManageSurvey.render_template('management/edit_survey.html',
                                              self.event, event=self.event, form=form, survey=None)
github indico / indico / indico / modules / oauth / controllers.py View on Github external
def _process(self):
        form = ApplicationForm(obj=FormDefaults(is_enabled=True))
        if form.validate_on_submit():
            application = OAuthApplication()
            form.populate_obj(application)
            db.session.add(application)
            db.session.flush()
            logger.info("Application %s created by %s", application, session.user)
            flash(_("Application {} registered successfully").format(application.name), 'success')
            return redirect(url_for('.app_details', application))
        return WPOAuthAdmin.render_template('app_new.html', form=form)
github indico / indico / indico_zodbimport / modules / event_managers.py View on Github external
self.process_principal(event, entries, submitter, 'Submitter', 'magenta!', roles={'submit'})
            # email-based (pending) submitters
            pqm = getattr(event, '_pendingQueuesMgr', None)
            if pqm is not None:
                emails = set(getattr(pqm, '_pendingConfSubmitters', []))
                self.process_emails(event, entries, emails, 'Submitter', 'magenta', roles={'submit'})
            db.session.add_all(entries.itervalues())
        # assign creators
        if creator_updates:
            self.print_step('saving event creators')
            stmt = (Event.__table__.update()
                    .where(Event.id == db.bindparam('event_id'))
                    .values(creator_id=db.bindparam('creator_id')))
            db.session.execute(stmt, creator_updates)
        updated = Event.find(Event.creator_id == None).update({Event.creator_id: self.janitor.id})  # noqa
        db.session.commit()
        self.print_success('Set the janitor user {} for {} events'.format(self.janitor, updated), always=True)
github indico / indico-plugins / livesync / indico_livesync / controllers.py View on Github external
def _process(self):
        form = self.backend.form(obj=FormDefaults(name=self.backend.title))
        if form.validate_on_submit():
            data = form.data
            name = data.pop('name')
            agent = LiveSyncAgent(name=name, backend_name=self.backend_name, settings=data)
            db.session.add(agent)
            flash(_('Agent added'), 'success')
            flash(_("Don't forget to run the initial export!"), 'highlight')
            return jsonify_data(flash=False)

        return jsonify_template('edit_agent.html', render_plugin_template, form=form, backend=self.backend, edit=False)
github indico / indico / indico / web / http_api / hooks / base.py View on Github external
raise HTTPAPIError('Guest access to this resource is forbidden.', 403)

        method_name = self._getMethodName()
        func = getattr(self, method_name, None)
        extra_func = getattr(self, method_name + '_extra', None)
        if not func:
            raise NotImplementedError(method_name)

        if not self.COMMIT:
            is_response, resultList, complete, extra = self._perform(user, func, extra_func)
            db.session.rollback()
        else:
            try:
                init_email_queue()
                is_response, resultList, complete, extra = self._perform(user, func, extra_func)
                db.session.commit()
                flush_email_queue()
            except Exception:
                db.session.rollback()
                raise
        if is_response:
            return resultList
        return resultList, extra, complete, self.SERIALIZER_TYPE_MAP
github indico / indico / indico_zodbimport / modules / news.py View on Github external
def migrate_news(self):
        self.print_step('migrating news')
        old_items = sorted(self.zodb_root['modules']['news']._newsItems, key=attrgetter('_creationDate'))
        for old_item in old_items:
            n = NewsItem(title=self._sanitize_title(old_item._title), content=convert_to_unicode(old_item._content),
                         created_dt=old_item._creationDate)
            db.session.add(n)
            db.session.flush()
            self.print_success(n.title)
        db.session.commit()