本文整理汇总了Python中social_auth.utils.clean_partial_pipeline函数的典型用法代码示例。如果您正苦于以下问题:Python clean_partial_pipeline函数的具体用法?Python clean_partial_pipeline怎么用?Python clean_partial_pipeline使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clean_partial_pipeline函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: auth_process
def auth_process(request, backend):
"""Authenticate using social backend"""
print(backend)
data = request.POST if request.method == 'POST' else request.GET
# Save extra data into session.
for field_name in setting('SOCIAL_AUTH_FIELDS_STORED_IN_SESSION', []):
if field_name in data:
request.session[field_name] = data[field_name]
# Save any defined next value into session
if REDIRECT_FIELD_NAME in data:
# Check and sanitize a user-defined GET/POST next field value
redirect = data[REDIRECT_FIELD_NAME]
if setting('SOCIAL_AUTH_SANITIZE_REDIRECTS', True):
redirect = sanitize_redirect(request.get_host(), redirect)
request.session[REDIRECT_FIELD_NAME] = redirect or DEFAULT_REDIRECT
# Clean any partial pipeline info before starting the process
clean_partial_pipeline(request)
if backend.uses_redirect:
return HttpResponseRedirect(backend.auth_url())
else:
return HttpResponse(backend.auth_html(),
content_type='text/html;charset=UTF-8')
开发者ID:jbau,项目名称:django-social-auth,代码行数:25,代码来源:views.py
示例2: pipeline
def pipeline(self, pipeline, *args, **kwargs):
"""Pipeline"""
out = kwargs.copy()
if 'pipeline_index' in kwargs:
base_index = int(kwargs['pipeline_index'])
else:
base_index = 0
for idx, name in enumerate(pipeline):
out['pipeline_index'] = base_index + idx
mod_name, func_name = name.rsplit('.', 1)
try:
mod = import_module(mod_name)
except ImportError:
log('exception', 'Error importing pipeline %s', name)
else:
func = getattr(mod, func_name, None)
if callable(func):
try:
result = func(*args, **out) or {}
except StopPipeline:
# Clean partial pipeline on stop
if 'request' in kwargs:
clean_partial_pipeline(kwargs['request'])
break
if isinstance(result, dict):
out.update(result)
else:
return result
return out
开发者ID:idonethis,项目名称:django-social-auth,代码行数:33,代码来源:__init__.py
示例3: pipeline
def pipeline(self, pipeline, *args, **kwargs):
"""Pipeline"""
out = kwargs.copy()
if 'pipeline_index' in kwargs:
base_index = int(kwargs['pipeline_index'])
else:
base_index = 0
for idx, name in enumerate(pipeline):
out['pipeline_index'] = base_index + idx
mod_name, func_name = name.rsplit('.', 1)
mod = import_module(mod_name)
func = getattr(mod, func_name, None)
try:
result = func(*args, **out) or {}
except StopPipeline:
# Clean partial pipeline on stop
if 'request' in kwargs:
clean_partial_pipeline(kwargs['request'])
break
if isinstance(result, dict):
out.update(result)
else:
return result
# clean the partial pipeline at the end of the process
if 'request' in kwargs:
clean_partial_pipeline(kwargs['request'])
return out
开发者ID:Rishabh2,项目名称:CittaAppDemo,代码行数:32,代码来源:__init__.py
示例4: auth
def auth(request, backend):
"""Authenticate using social backend"""
data = request.POST if request.method == "POST" else request.GET
# Save extra data into session.
for field_name in setting("SOCIAL_AUTH_FIELDS_STORED_IN_SESSION", []):
if field_name in data:
request.session[field_name] = data[field_name]
# Save any defined next value into session
if REDIRECT_FIELD_NAME in data:
# Check and sanitize a user-defined GET/POST next field value
redirect = data[REDIRECT_FIELD_NAME]
# NOTE: django-sudo's `is_safe_url` is much better at catching bad
# redirections to different domains than social_auth's
# `sanitize_redirect` call.
if not is_safe_url(redirect, host=request.get_host()):
redirect = DEFAULT_REDIRECT
request.session[REDIRECT_FIELD_NAME] = redirect or DEFAULT_REDIRECT
# Clean any partial pipeline info before starting the process
clean_partial_pipeline(request)
if backend.uses_redirect:
return HttpResponseRedirect(backend.auth_url())
else:
return HttpResponse(backend.auth_html(), content_type="text/html;charset=UTF-8")
开发者ID:alexm92,项目名称:sentry,代码行数:27,代码来源:views.py
示例5: pipeline
def pipeline(self, pipeline, *args, **kwargs):
"""Pipeline"""
out = kwargs.copy()
for name in pipeline:
mod_name, func_name = name.rsplit(".", 1)
try:
mod = import_module(mod_name)
except ImportError:
log("exception", "Error importing pipeline %s", name)
else:
func = getattr(mod, func_name, None)
if callable(func):
try:
result = func(*args, **out) or {}
except StopPipeline:
# Clean partial pipeline on stop
if "request" in kwargs:
clean_partial_pipeline(kwargs["request"])
break
if isinstance(result, dict):
out.update(result)
else:
return result
return out
开发者ID:vrosnet,项目名称:django-social-auth,代码行数:27,代码来源:__init__.py
示例6: pipeline
def pipeline(self, pipeline, *args, **kwargs):
"""Pipeline"""
out = kwargs.copy()
if "pipeline_index" in kwargs:
base_index = int(kwargs["pipeline_index"])
else:
base_index = 0
for idx, name in enumerate(pipeline):
out["pipeline_index"] = base_index + idx
mod_name, func_name = name.rsplit(".", 1)
mod = import_module(mod_name)
func = getattr(mod, func_name, None)
try:
result = func(*args, **out) or {}
except StopPipeline:
# Clean partial pipeline on stop
if "request" in kwargs:
clean_partial_pipeline(kwargs["request"])
break
if isinstance(result, dict):
out.update(result)
else:
return result
return out
开发者ID:numan,项目名称:django-social-auth,代码行数:28,代码来源:__init__.py
示例7: auth_process
def auth_process(request, backend):
"""Authenticate using social backend"""
# Save any defined next value into session
data = (request.POST if request.method == 'POST' else request.GET).dict()
if REDIRECT_FIELD_NAME in data:
# Check and sanitize a user-defined GET/POST next field value
redirect = data[REDIRECT_FIELD_NAME]
if setting('SOCIAL_AUTH_SANITIZE_REDIRECTS', True):
redirect = sanitize_redirect(request.get_host(), redirect)
request.session[REDIRECT_FIELD_NAME] = redirect or DEFAULT_REDIRECT
# Clean any partial pipeline info before starting the process
clean_partial_pipeline(request)
if backend.uses_redirect:
query = urlencode(data)
auth_url = backend.auth_url(data.get('extra_scope', ''))
if query:
auth_url += "&" + query
return HttpResponseRedirect(auth_url)
else:
return HttpResponse(backend.auth_html(),
content_type='text/html;charset=UTF-8')
开发者ID:Bunch,项目名称:django-social-auth,代码行数:25,代码来源:views.py
示例8: auth_process
def auth_process(request, backend):
"""Authenticate using social backend"""
# Added by Mike:
# Save any query parameters into session.
data = request.POST if request.method == 'POST' else request.GET
for key, value in data.items():
request.session[key] = value
# Save any defined next value into session
data = request.POST if request.method == 'POST' else request.GET
if REDIRECT_FIELD_NAME in data:
# Check and sanitize a user-defined GET/POST next field value
redirect = data[REDIRECT_FIELD_NAME]
if setting('SOCIAL_AUTH_SANITIZE_REDIRECTS', True):
redirect = sanitize_redirect(request.get_host(), redirect)
request.session[REDIRECT_FIELD_NAME] = redirect or DEFAULT_REDIRECT
# Clean any partial pipeline info before starting the process
clean_partial_pipeline(request)
if backend.uses_redirect:
return HttpResponseRedirect(backend.auth_url())
else:
return HttpResponse(backend.auth_html(),
content_type='text/html;charset=UTF-8')
开发者ID:idonethis,项目名称:django-social-auth,代码行数:25,代码来源:views.py
示例9: auth_process
def auth_process(request, backend):
"""Authenticate using social backend"""
# Save any defined next value into session
data = request.POST if request.method == "POST" else request.GET
for field in data:
if field == REDIRECT_FIELD_NAME:
# Check and sanitize a user-defined GET/POST next field value
redirect = data[REDIRECT_FIELD_NAME]
if setting("SOCIAL_AUTH_SANITIZE_REDIRECTS", True):
redirect = sanitize_redirect(request.get_host(), redirect)
request.session[REDIRECT_FIELD_NAME] = redirect or DEFAULT_REDIRECT
else:
request.session[field] = data[field]
# Clean any partial pipeline info before starting the process
clean_partial_pipeline(request)
if backend.uses_redirect:
return HttpResponseRedirect(backend.auth_url())
else:
return HttpResponse(backend.auth_html(), content_type="text/html;charset=UTF-8")
开发者ID:arnaudbreton,项目名称:django-social-auth,代码行数:21,代码来源:views.py
注:本文中的social_auth.utils.clean_partial_pipeline函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论