Commits

Jakub Zalewski committed 792e9aa

force session creation utility

  • Participants
  • Parent commits b4b7df1

Comments (0)

Files changed (1)

annoying/sessions.py

+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+from django.conf import settings
+from django.utils.importlib import import_module
+
+
+def create_session(client):
+    # force session creation
+    # https://code.djangoproject.com/ticket/10899
+    engine = import_module(settings.SESSION_ENGINE)
+    store = engine.SessionStore()
+    store.save()
+    client.cookies[settings.SESSION_COOKIE_NAME] = store.session_key