Skip to content

Instantly share code, notes, and snippets.

@pinder
pinder / middleware.py
Last active December 23, 2015 11:38 — forked from jzylks/middleware.py
Updated for Django 1.4, with httponly support
from types import MethodType
from django.http import SimpleCookie, HttpRequest
def _set_cookie(self, key, value='', max_age=None, expires=None, path='/',
domain=None, secure=False, httponly=False):
self._resp_cookies[key] = value
self.COOKIES[key] = value
if max_age is not None: