diff options
author | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2013-03-21 09:01:48 +0100 |
---|---|---|
committer | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2013-03-21 09:04:37 +0100 |
commit | dc7c26f3559be00e272c5c880f87c7550d80baae (patch) | |
tree | 08609b2365a800e3449d97b6b0c62c4b37a17cf7 /mediagoblin/plugins/piwigo | |
parent | 1330abf722ff894e1a7f492718519a8cb5290a0b (diff) | |
download | mediagoblin-dc7c26f3559be00e272c5c880f87c7550d80baae.tar.lz mediagoblin-dc7c26f3559be00e272c5c880f87c7550d80baae.tar.xz mediagoblin-dc7c26f3559be00e272c5c880f87c7550d80baae.zip |
piwigo: Sent a fake cookie.
shotwell needs a pwg_id cookie to continue.
And really, it's the only cookie it supports, so in the
long run, we need to send a proper session cookie as
pwg_id.
Diffstat (limited to 'mediagoblin/plugins/piwigo')
-rw-r--r-- | mediagoblin/plugins/piwigo/views.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/mediagoblin/plugins/piwigo/views.py b/mediagoblin/plugins/piwigo/views.py index 2b6b7b0c..d0629b73 100644 --- a/mediagoblin/plugins/piwigo/views.py +++ b/mediagoblin/plugins/piwigo/views.py @@ -69,6 +69,19 @@ def pwg_categories_getList(request): } +def possibly_add_cookie(request, response): + # TODO: We should only add a *real* cookie, if + # authenticated. And if there is no cookie already. + if True: + response.set_cookie( + 'pwg_id', + "some_fake_for_now", + path=request.environ['SCRIPT_NAME'], + domain=mg_globals.app_config.get('csrf_cookie_domain'), + secure=(request.scheme.lower() == 'https'), + httponly=True) + + @csrf_exempt def ws_php(request): if request.method not in ("GET", "POST"): @@ -86,4 +99,8 @@ def ws_php(request): if isinstance(result, BaseResponse): return result - return response_xml(result) + response = response_xml(result) + + possibly_add_cookie(request, response) + + return response |