Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow cross-domain cookie #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ changed in your own ``settings.py``:

**Default:** ``False``

``FLAVOURS_COOKIE_DOMAIN``
The value that get passed into ``HttpResponse.set_cookie``'s ``domain``
argument. Set this to ``.yourdomain.com`` if you want to use cross-domain cookie which is readable by its domain and its subdomains, e.g. sub.yourdomain.com. Otherwise, it's only readable by its domain.

**Default:** ``None``

``FLAVOURS_COOKIE_KEY``
The cookie name that is used for storing the selected flavour in the
browser. This is only used if ``FLAVOURS_STORAGE_BACKEND`` is set to
Expand Down
1 change: 1 addition & 0 deletions django_mobile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def save(self, request, response):
response.set_cookie(
smart_str(settings.FLAVOURS_COOKIE_KEY),
smart_str(request._flavour_cookie),
domain=settings.FLAVOURS_COOKIE_DOMAIN,
httponly=settings.FLAVOURS_COOKIE_HTTPONLY)


Expand Down
1 change: 1 addition & 0 deletions django_mobile/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class defaults(object):
FLAVOURS_GET_PARAMETER = u'flavour'
FLAVOURS_STORAGE_BACKEND = u'cookie'
FLAVOURS_COOKIE_KEY = u'flavour'
FLAVOURS_COOKIE_DOMAIN = None
FLAVOURS_COOKIE_HTTPONLY = False
FLAVOURS_SESSION_KEY = u'flavour'
FLAVOURS_TEMPLATE_LOADERS = []
Expand Down