views.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:idealoom 作者: conversence 项目源码 文件源码
def get_login_context(request, force_show_providers=False):
    slug = request.matchdict.get('discussion_slug', None)
    if slug:
        request.session['discussion'] = slug
    else:
        request.session.pop('discussion')
    discussion = discussion_from_request(request)
    get_routes = create_get_route(request, discussion)
    providers = get_provider_data(get_routes)
    hide_registration = (discussion
        and not public_roles.intersection(set(roles_with_permissions(
            discussion, P_READ)))
        and not roles_with_permissions(
            discussion, P_SELF_REGISTER_REQUEST, P_SELF_REGISTER))
    if not force_show_providers:
        hide_providers = aslist(request.registry.settings.get(
            'hide_login_providers', ()))

        if isinstance(hide_providers, string_types):
            hide_providers = (hide_providers, )
        providers = [p for p in providers if p['type'] not in hide_providers]

    return dict(get_default_context(request),
                providers=providers,
                providers_json=json.dumps(providers),
                saml_providers=request.registry.settings.get(
                    'SOCIAL_AUTH_SAML_ENABLED_IDPS', {}),
                hide_registration=hide_registration,
                identifier = request.params.get('identifier', ''),
                google_consumer_key=request.registry.settings.get(
                    'google.consumer_key', ''),
                next=handle_next_view(request),
                get_route=get_routes)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号