Python google.appengine.api.users 模块,create_logout_url() 实例源码

我们从Python开源项目中,提取了以下22个代码示例,用于说明如何使用google.appengine.api.users.create_logout_url()

项目:sndlatr    作者:Schibum    | 项目源码 | 文件源码
def get(self):
        self.redirect(users.create_logout_url('/'))
项目:isthislegit    作者:duo-labs    | 项目源码 | 文件源码
def logout():
    '''
    Manually override the logout URL to avoid completely signing the user
    out of all Google accounts
    '''
    if os.getenv('SERVER_SOFTWARE', '').startswith('Google App Engine/'):
        return redirect('_ah/logout?continue=https://' + request.host + '/')
    return redirect(users.create_logout_url('/'))
项目:touch-pay-client    作者:HackPucBemobi    | 项目源码 | 文件源码
def logout_url(self, next="/"):
        return users.create_logout_url(next)
项目:tesismometro    作者:joapaspe    | 项目源码 | 文件源码
def user_view():
    """
        User interface (only shows the token).
        :return: An http response with the submitted information.
    """
    user = users.get_current_user()

    if not user:
        return redirect(users.create_login_url("/user"))
    email = user.email()
    doctors = tesis_bd.Doctor.query(tesis_bd.Doctor.email == email).fetch()

    if len(doctors) == 0:
        return render_template('error.html', message="User not found in the DB.")

    doctor = doctors[0]
    name = doctor.name

    if not doctor.token:
        doctor.token = "%016x" % random.getrandbits(64)
    code = doctor.token

    doctor.put()
    logout_url = users.create_logout_url("/")
    return render_template('user_view.html', login=doctor.name, name=name, email=email, code=code,
                           logout_url=logout_url)
项目:daytravel    作者:warsawpact    | 项目源码 | 文件源码
def get(self):
        current_user = users.get_current_user()
        logout_url= users.create_logout_url('/')
        login_url= users.create_login_url('/')

        template = jinja_environment.get_template("templates/daytravel.html")
        template_vars = {
        'current_user': current_user,
        'logout_url': logout_url,
        'login_url': login_url,
        }
        self.response.write(template.render(template_vars))
项目:daytravel    作者:warsawpact    | 项目源码 | 文件源码
def post(self):
        city= self.request.get('city')
        current_user = users.get_current_user()
        logout_url= users.create_logout_url('/')
        login_url= users.create_login_url('/')

        self.redirect('/plan?city=' + city)
项目:daytravel    作者:warsawpact    | 项目源码 | 文件源码
def get(self):
        city = self.request.get('city')
        logout_url = users.create_logout_url('/')

        template = jinja_environment.get_template("templates/plan.html")
        template_vars = {
            'city': city,
            'logout_url': logout_url,
        }
        self.response.write(template.render(template_vars))
项目:daytravel    作者:warsawpact    | 项目源码 | 文件源码
def post(self):
        city = self.request.get('city')
        activities = self.request.get_all('activity')
        logout_url = users.create_logout_url('/')
        bearer_token = obtain_bearer_token(API_HOST, TOKEN_PATH)

        # this is where we pass in form input
        response = search(bearer_token, 'hiking', city)
        self.redirect('/results?city=' + city + '&activity=' + ','.join(activities))
项目:true_review_web2py    作者:lucadealfaro    | 项目源码 | 文件源码
def logout_url(self, next="/"):
        return users.create_logout_url(next)
项目:spc    作者:whbrewer    | 项目源码 | 文件源码
def logout_url(self, next="/"):
        return users.create_logout_url(next)
项目:Problematica-public    作者:TechMaz    | 项目源码 | 文件源码
def logout_url(self, next="/"):
        return users.create_logout_url(next)
项目:beg-django-e-commerce    作者:Apress    | 项目源码 | 文件源码
def google_logout(request, next_page=None,
        template_name='registration/logged_out.html'):
    if users.get_current_user():
        # Redirect to this page until the session has been cleared.
        logout_url = users.create_logout_url(next_page or request.path)
        return HttpResponseRedirect(logout_url)
    if not next_page:
        return render_to_response(request, template_name,
            {'title': _('Logged out')})
    return HttpResponseRedirect(next_page)
项目:beg-django-e-commerce    作者:Apress    | 项目源码 | 文件源码
def google_logout_url(redirect='/'):
    prefixes = getattr(settings, 'LOGIN_REQUIRED_PREFIXES', ())
    if any(redirect.startswith(prefix) for prefix in prefixes):
        redirect = '/'
    return escape(users.create_logout_url(redirect))
项目:rekall-agent-server    作者:rekall-innovations    | 项目源码 | 文件源码
def logout_url(self, next="/"):
        return users.create_logout_url(next)
项目:tichu-tournament    作者:aragos    | 项目源码 | 文件源码
def get(self):
    ''' Redirect to Google logout page, followed by another redirect to the 
    URL specified by [then] argument.

    See api for request and response documentation.
    '''
    url = users.create_logout_url(dest_url=self.request.get('then'))
    self.redirect(url)
项目:appbackendapi    作者:codesdk    | 项目源码 | 文件源码
def get(self):
        user = users.get_current_user()
        if user:
            nickname = user.nickname()
            logout_url = users.create_logout_url('/')
            greeting = 'Welcome, {}! (<a href="{}">sign out</a>)'.format(
                nickname, logout_url)
        else:
            login_url = users.create_login_url('/')
            greeting = '<a href="{}">Sign in</a>'.format(login_url)

        self.response.write(
            '<html><body>{}</body></html>'.format(greeting))
项目:slugiot-client    作者:slugiot    | 项目源码 | 文件源码
def logout_url(self, next="/"):
        return users.create_logout_url(next)
项目:cas-eval    作者:varepsilon    | 项目源码 | 文件源码
def main():
    user = users.get_current_user()
    if not user:
        return flask.redirect(users.create_login_url(flask.request.path))

    if flask.request.method == 'POST':
        util.csrf_protect()
        tab_ids = flask.request.values.getlist('tab_id')
        keys = [ndb.Key(Session, tab_id) for tab_id in tab_ids]
        if 'delete' in flask.request.values:
            if not all(s and s.user_id == user.user_id() for s in ndb.get_multi(keys)):
                return 'Not authorized to delete some sessions', 403
            ndb.delete_multi(keys)
        elif 'share' in flask.request.values:
            for key in keys:
                session = key.get()
                if session and session.user_id == user.user_id():
                    session.shared = True
                    session.put()
        else:
            return 'Incorrect POST name', 400
    date = flask.request.values.get('date', datetime.now().strftime('%Y-%m-%d'))
    cur_day = datetime.strptime(date, '%Y-%m-%d')
    next_day = cur_day + timedelta(days=1)
    sessions = (Session.query(Session.user_id == user.user_id(),
                Session.start_ts >= cur_day, Session.start_ts < next_day)
            .order(-Session.start_ts))
    num_shared = Session.query(Session.user_id == user.user_id(), Session.shared == True).count()
    return flask.render_template('main.html',
                                 user=user,
                                 date=date,
                                 year=datetime.now().year,
                                 logout_url=users.create_logout_url('/'),
                                 sessions=sessions,
                                 num_shared=num_shared)
项目:cas-eval    作者:varepsilon    | 项目源码 | 文件源码
def leaderboard():
    user = users.get_current_user()
    num_shared = []
    for u in Session.query(projection=['user_id'], distinct=True):
        num_shared.append((
            Session.query(Session.user_id == u.user_id, Session.shared == True).count(),
            u.user_id))
    num_shared.sort(reverse=True)
    return flask.render_template('leaderboard.html', user=user, year=datetime.now().year,
        logout_url=users.create_logout_url('/'), num_shared=num_shared)
项目:share-class    作者:junyiacademy    | 项目源码 | 文件源码
def get(self):

        user_property = users.get_current_user()

        if user_property:
            google_logout_url = users.create_logout_url('/')
            self.redirect(google_logout_url)

        else:
            self.redirect('/')
项目:StuffShare    作者:StuffShare    | 项目源码 | 文件源码
def logout_url(self, next="/"):
        return users.create_logout_url(next)
项目:daytravel    作者:warsawpact    | 项目源码 | 文件源码
def get(self):
        city= self.request.get('city')
        activities = self.request.get('activity')
        logout_url = users.create_logout_url('/')
        activity_list = activities.split(',')

        activity_dict = {}
        split_list = []
        for activity in activity_list:
            #split on '.', save into a new list
            split_list = activity.split('.')
            key = split_list[0]
            value = split_list[1]
            if key in activity_dict:
                activity_dict[key].append(value)
            else:
                activity_dict[key] = [value]


        results_list = []
        bearer_token = obtain_bearer_token(API_HOST, TOKEN_PATH)

        for category in activity_dict:
            category_dict = {
                'name': category
            }
            subcategories_list = []
            for subcategory in activity_dict[category]:
                response = search(bearer_token, subcategory, city)
                list_of_businesses = response['businesses']
                dict1 = list_of_businesses[0]
                business_name = dict1['name']
                link = dict1['url']
                subcategory = {
                    'name': subcategory,
                    'business_name': business_name,
                    'link': link
                }
                subcategories_list.append(subcategory)
            category_dict['subcategories'] = subcategories_list
            results_list.append(category_dict)
        print(results_list)

        template = jinja_environment.get_template("templates/results.html")
        template_vars = {
            'city': city,
            'activities': activities,
            'logout_url': logout_url,
            'activity_dict': activity_dict,
            'results_list': results_list
        }
        self.response.write(template.render(template_vars))