Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(3)  |  Call(1)  |  Derive(0)  |  Import(2)
Reduces the scheme and host from a given URL so it can be passed to
the given `login` URL more efficiently.

:param login_url: The login URL being redirected to.
:type login_url: str
:param current_url: The URL to reduce.
:type current_url: str

        def make_next_param(login_url, current_url):
    '''
    Reduces the scheme and host from a given URL so it can be passed to
    the given `login` URL more efficiently.

    :param login_url: The login URL being redirected to.
    :type login_url: str
    :param current_url: The URL to reduce.
    :type current_url: str
    '''
    l = urlparse(login_url)
    c = urlparse(current_url)

    if (not l.scheme or l.scheme == c.scheme) and \
            (not l.netloc or l.netloc == c.netloc):
        return urlunparse(('', '', c.path, c.params, c.query, ''))
    return current_url
        


src/f/l/flask-todo-HEAD/backend/auth.py   flask-todo(Download)
from flask import render_template, current_app, request, redirect
from flask.ext.restful.reqparse import Argument, RequestParser
from flask.ext.login import LoginManager, AnonymousUser, login_user, user_unauthorized, login_url, make_next_param
 
from utils.sqlalchemyutils import get_or_create
def unauthorized_handler():
    user_unauthorized.send(user_unauthorized.send(current_app._get_current_object()))
    url = URLObject(login_url(login_manager.login_view, request.url))
    prev_param = make_next_param(url.without_query(), request.referrer or '/')
    return redirect(url.add_query_param('prev', prev_param).add_query_param('mode', 'action'))

src/f/l/flask-login-HEAD/test_login.py   flask-login(Download)
from flask import Flask, Response, session, get_flashed_messages
 
from flask.ext.login import (LoginManager, UserMixin, AnonymousUserMixin,
                             make_secure_token, current_user, login_user,
                             logout_user, user_logged_in, user_logged_out,