How to use the indico.web.flask.util.url_for function in indico

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 / 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 / modules / events / features / __init__.py View on Github external
def _extend_event_management_menu(sender, event, **kwargs):
    if not event.can_manage(session.user):
        return
    return SideMenuItem('features', 'Features', url_for('event_features.index', event), section='advanced')
github indico / indico / indico / modules / events / layout / models / menu.py View on Github external
return self.link_url
        elif (self.is_internal_link or self.is_plugin_link) and not self.default_data.endpoint:
            return None
        elif self.is_internal_link:
            data = self.default_data
            if data.static_site and isinstance(data.static_site, basestring) and g.get('static_site'):
                return data.static_site
            kwargs = {}
            if self.name == 'timetable':
                from indico.modules.events. layout import layout_settings
                if layout_settings.get(self.event_ref, 'timetable_by_room'):
                    kwargs['layout'] = 'room'
                if layout_settings.get(self.event_ref, 'timetable_detailed'):
                    start_date = self.event_ref.start_dt_local
                    kwargs['_anchor'] = start_date.strftime('%Y%m%d.detailed')
            return url_for(data.endpoint, self.event_ref, _external=False, **kwargs)
        elif self.is_plugin_link:
            from indico.core.plugins import url_for_plugin
            return url_for_plugin(self.default_data.endpoint, self.event_ref, _external=False)
        elif self.is_page:
            return url_for('event_pages.page_display', self.event_ref, page_id=self.page_id, slug=slugify(self.title),
                           _external=False)
        else:
            return None
github indico / indico / indico / modules / auth / controllers.py View on Github external
def _send_confirmation(email, salt, endpoint, template, template_args=None, url_args=None, data=None):
    template_args = template_args or {}
    url_args = url_args or {}
    token = secure_serializer.dumps(data or email, salt=salt)
    url = url_for(endpoint, token=token, _external=True, **url_args)
    template_module = get_template_module(template, email=email, url=url, **template_args)
    send_email(make_email(email, template=template_module))
    flash(_('We have sent you a verification email. Please check your mailbox within the next hour and open '
            'the link in that email.'))
    return redirect(url_for(endpoint, **url_args))
github indico / indico / indico / modules / users / __init__.py View on Github external
def _sidemenu_items(sender, user, **kwargs):
    yield SideMenuItem('dashboard', _('Dashboard'), url_for('users.user_dashboard'), 100, disabled=user.is_system)
    yield SideMenuItem('personal_data', _('Personal data'), url_for('users.user_profile'), 90)
    yield SideMenuItem('emails', _('Emails'), url_for('users.user_emails'), 80, disabled=user.is_system)
    yield SideMenuItem('preferences', _('Preferences'), url_for('users.user_preferences'), 70, disabled=user.is_system)
    yield SideMenuItem('favorites', _('Favourites'), url_for('users.user_favorites'), 60, disabled=user.is_system)
github indico / indico / indico / core / celery / __init__.py View on Github external
def _extend_admin_menu(sender, **kwargs):
    if session.user.is_admin:
        return SideMenuItem('celery', _("Tasks"), url_for('celery.index'), 20, icon='time')
github indico / indico / indico / modules / events / models / events.py View on Github external
def short_external_url(self):
        id_ = self.url_shortcut or self.id
        return url_for('events.shorturl', confId=id_, _external=True)
github indico / indico / indico / modules / events / agreements / placeholders.py View on Github external
def render(cls, definition, agreement):
        return Markup('<a href="{0}">{0}</a>'.format(url_for('agreements.agreement_form', agreement,
                                                             uuid=agreement.uuid, _external=True)))
github indico / indico / indico / modules / events / payment / plugins.py View on Github external
def get_event_management_url(self, event, **kwargs):
        # This is needed only in case a plugin overrides `can_be_modified` and grants access to users who do not have
        # event management access. In this case they should be redirected to the plugin's edit payment page.
        # In the future it might be useful to expose a limited version of the main payment page to those users since
        # right now there is no good way to access both payment methods if there are two of this kind and you have
        # access to both.
        if session.user and self.can_be_modified(session.user, event):
            return url_for('payment.event_plugin_edit', event, method=re.sub(r'^payment_', '', self.name))