How to use the pyramid.httpexceptions.HTTPSeeOther function in pyramid

To help you get started, we’ve selected a few pyramid 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 pypa / warehouse / warehouse / manage / views.py View on Github external
def _error(message):
            self.request.session.flash(message, queue="error")
            return HTTPSeeOther(
                self.request.route_path(
                    "manage.project.release",
                    project_name=self.release.project.name,
                    version=self.release.version,
                )
github eevee / floof / floof / views / account.py View on Github external
def retry():
        """Redirect to the login page, preserving the return key (if any)."""
        location = request.route_url('account.login')
        if return_key:
            location = update_params(location, return_key=return_key)
        return HTTPSeeOther(location=location)
github eevee / spline / spline_love / views.py View on Github external
def express_love__do(request):
    # TODO real form handling thx

    source = request.user
    # TODO error handling lol
    target = session.query(User).filter_by(name=request.POST['target']).one()

    session.add(Love(
        source=source,
        target=target,
        comment=request.POST['comment'],
    ))

    return HTTPSeeOther(request.route_url('love.list'))
github Weasyl / weasyl / weasyl / controllers / interaction.py View on Github external
def unfollowuser_(request):
    form = request.web_input(userid="")
    form.otherid = define.get_int(form.userid)

    followuser.remove(request.userid, form.otherid)

    raise HTTPSeeOther(location="/manage/following")
github aptise / peter_sslers / peter_sslers / web / views_admin / acme_account.py View on Github external
return {"result": "success", "AcmeAccount": dbAcmeAccount.as_json}
            url_success = "%s?result=success&operation=mark&action=%s" % (
                self._focus_url,
                action,
            )
            return HTTPSeeOther(url_success)

        except formhandling.FormInvalid as exc:
            if self.request.wants_json:
                return {"result": "error", "form_errors": formStash.errors}
            url_failure = "%s?result=error&error=%s&operation=mark&action=%s" % (
                self._focus_url,
                errors.formstash_to_querystring(formStash),
                action,
            )
            raise HTTPSeeOther(url_failure)
github Weasyl / weasyl / weasyl / controllers / interaction.py View on Github external
def ignoreuser_(request):
    form = request.web_input(userid="")
    otherid = define.get_int(form.userid)

    if form.action == "ignore":
        ignoreuser.insert(request.userid, [otherid])
    elif form.action == "unignore":
        ignoreuser.remove(request.userid, [otherid])

    raise HTTPSeeOther(location="/~%s" % (define.get_sysname(define.get_display_name(otherid))))
github eevee / floof / floof / views / controls / auth.py View on Github external
def persona_remove(context, request):
    user = request.user
    form = RemovePersonaForm(request, request.POST)
    form.addrs.query = model.session.query(model.IdentityEmail).with_parent(user)

    if not form.validate():
        return {'form': form}

    for target in form.addrs.data:
        user.identity_emails.remove(target)
        request.session.flash(
            u"Removed Persona identity email address: {0}"
            .format(target.email), level=u'success')

    return HTTPSeeOther(location=request.route_url('controls.persona'))
github eevee / floof / floof / views / controls.py View on Github external
if not request.POST.get('confirm', False):
        # XXX better redirect whatever
        request.session.flash(
            u"If you REALLY REALLY want to unwatch {0}, check the box and try again.".format(target_user.name),
            level=u'error')
        return HTTPBadRequest()

    model.session.query(model.UserWatch) \
        .filter_by(user=request.user, other_user=target_user) \
        .delete()

    # XXX where should this redirect?
    request.session.flash(
        u"Unwatched {0}.".format(target_user.name),
        level=u'success')
    return HTTPSeeOther(request.route_url('users.view', user=target_user))
github assembl / assembl / assembl / views / discussion / views.py View on Github external
def purl_post(request):
    slug = request.matchdict['discussion_slug']
    discussion = Discussion.default_db.query(Discussion).\
        filter_by(slug=slug).first()
    if not discussion:
        raise HTTPNotFound()
    furl = FrontendUrls(discussion)
    post_id = furl.getRequestedPostId(request)
    post = get_named_object(post_id)
    if not post:
        raise HTTPNotFound()
    phase = discussion.current_discussion_phase()
    if (discussion.preferences['landing_page'] and (
            phase is None or not phase.interface_v1)):
        return HTTPSeeOther(location=post.get_url())

    # V1 purl
    return HTTPOk(
        location=request.route_url(
            'purl_posts',
            discussion_slug=discussion.slug,
            remainder=quote_plus(type(post).uri_generic(post.id)))
    )
github Weasyl / weasyl / weasyl / controllers / moderation.py View on Github external
def modcontrol_editcatchphrase_(request):
    form = request.web_input(userid="", content="")

    moderation.editcatchphrase(request.userid, define.get_int(form.userid), form.content)
    raise HTTPSeeOther(location="/modcontrol")