【发布时间】:2016-12-22 19:30:34
【问题描述】:
我正在使用带有 shopify_auth 包的 Django 来连接 Shopify。
有没有人有任何关于如何处理多商店会话/连接的示例?
到目前为止,我正在考虑使用以下内容修改 shopify_auth 的 @login_required 装饰器,但我不确定我是否会错过任何内容:
在 shopify_auth/decortaors.py 中:
def login_required(f, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None):
@wraps(f)
def wrapper(request, *args, **kwargs):
if request.user.is_authenticated():
# Extract the Shopify-specific authentication parameters from the current request.
new_request_d = [ ... get request.GET params ('shop', etc.) ... ]
# Compare current active request.user with new reqeust.GET's 'shop'
if request.user != new_request_d['shop']:
[ ... do something to change session to the other shop ...]
[ ... redirect as necessary .... ]
return f(request, *args, **kwargs)
在 shopify_auth 模块中,它们是 unresolved issue about this。
它暗示using the ruby implementation。
任何正确方向的帮助将不胜感激。
【问题讨论】: