This commit is contained in:
Mai Gillmann
2019-12-17 14:09:10 +01:00
parent 66e908fc8a
commit 4791d00a43
2122 changed files with 423791 additions and 0 deletions
@@ -0,0 +1,202 @@
import datetime
import logging
import os
import shutil
import tempfile
from django.conf import settings
from django.contrib.sessions.backends.base import (
VALID_KEY_CHARS, CreateError, SessionBase, UpdateError,
)
from django.contrib.sessions.exceptions import InvalidSessionKey
from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation
from django.utils import timezone
class SessionStore(SessionBase):
"""
Implement a file based session store.
"""
def __init__(self, session_key=None):
self.storage_path = type(self)._get_storage_path()
self.file_prefix = settings.SESSION_COOKIE_NAME
super().__init__(session_key)
@classmethod
def _get_storage_path(cls):
try:
return cls._storage_path
except AttributeError:
storage_path = getattr(settings, 'SESSION_FILE_PATH', None) or tempfile.gettempdir()
# Make sure the storage path is valid.
if not os.path.isdir(storage_path):
raise ImproperlyConfigured(
"The session storage path %r doesn't exist. Please set your"
" SESSION_FILE_PATH setting to an existing directory in which"
" Django can store session data." % storage_path)
cls._storage_path = storage_path
return storage_path
def _key_to_file(self, session_key=None):
"""
Get the file associated with this session key.
"""
if session_key is None:
session_key = self._get_or_create_session_key()
# Make sure we're not vulnerable to directory traversal. Session keys
# should always be md5s, so they should never contain directory
# components.
if not set(session_key).issubset(VALID_KEY_CHARS):
raise InvalidSessionKey(
"Invalid characters in session key")
return os.path.join(self.storage_path, self.file_prefix + session_key)
def _last_modification(self):
"""
Return the modification time of the file storing the session's content.
"""
modification = os.stat(self._key_to_file()).st_mtime
if settings.USE_TZ:
modification = datetime.datetime.utcfromtimestamp(modification)
return modification.replace(tzinfo=timezone.utc)
return datetime.datetime.fromtimestamp(modification)
def _expiry_date(self, session_data):
"""
Return the expiry time of the file storing the session's content.
"""
return session_data.get('_session_expiry') or (
self._last_modification() + datetime.timedelta(seconds=settings.SESSION_COOKIE_AGE)
)
def load(self):
session_data = {}
try:
with open(self._key_to_file(), "r", encoding="ascii") as session_file:
file_data = session_file.read()
# Don't fail if there is no data in the session file.
# We may have opened the empty placeholder file.
if file_data:
try:
session_data = self.decode(file_data)
except (EOFError, SuspiciousOperation) as e:
if isinstance(e, SuspiciousOperation):
logger = logging.getLogger('django.security.%s' % e.__class__.__name__)
logger.warning(str(e))
self.create()
# Remove expired sessions.
expiry_age = self.get_expiry_age(expiry=self._expiry_date(session_data))
if expiry_age <= 0:
session_data = {}
self.delete()
self.create()
except (IOError, SuspiciousOperation):
self._session_key = None
return session_data
def create(self):
while True:
self._session_key = self._get_new_session_key()
try:
self.save(must_create=True)
except CreateError:
continue
self.modified = True
return
def save(self, must_create=False):
if self.session_key is None:
return self.create()
# Get the session data now, before we start messing
# with the file it is stored within.
session_data = self._get_session(no_load=must_create)
session_file_name = self._key_to_file()
try:
# Make sure the file exists. If it does not already exist, an
# empty placeholder file is created.
flags = os.O_WRONLY | getattr(os, 'O_BINARY', 0)
if must_create:
flags |= os.O_EXCL | os.O_CREAT
fd = os.open(session_file_name, flags)
os.close(fd)
except FileNotFoundError:
if not must_create:
raise UpdateError
except FileExistsError:
if must_create:
raise CreateError
# Write the session file without interfering with other threads
# or processes. By writing to an atomically generated temporary
# file and then using the atomic os.rename() to make the complete
# file visible, we avoid having to lock the session file, while
# still maintaining its integrity.
#
# Note: Locking the session file was explored, but rejected in part
# because in order to be atomic and cross-platform, it required a
# long-lived lock file for each session, doubling the number of
# files in the session storage directory at any given time. This
# rename solution is cleaner and avoids any additional overhead
# when reading the session data, which is the more common case
# unless SESSION_SAVE_EVERY_REQUEST = True.
#
# See ticket #8616.
dir, prefix = os.path.split(session_file_name)
try:
output_file_fd, output_file_name = tempfile.mkstemp(dir=dir, prefix=prefix + '_out_')
renamed = False
try:
try:
os.write(output_file_fd, self.encode(session_data).encode())
finally:
os.close(output_file_fd)
# This will atomically rename the file (os.rename) if the OS
# supports it. Otherwise this will result in a shutil.copy2
# and os.unlink (for example on Windows). See #9084.
shutil.move(output_file_name, session_file_name)
renamed = True
finally:
if not renamed:
os.unlink(output_file_name)
except (OSError, IOError, EOFError):
pass
def exists(self, session_key):
return os.path.exists(self._key_to_file(session_key))
def delete(self, session_key=None):
if session_key is None:
if self.session_key is None:
return
session_key = self.session_key
try:
os.unlink(self._key_to_file(session_key))
except OSError:
pass
def clean(self):
pass
@classmethod
def clear_expired(cls):
storage_path = cls._get_storage_path()
file_prefix = settings.SESSION_COOKIE_NAME
for session_file in os.listdir(storage_path):
if not session_file.startswith(file_prefix):
continue
session_key = session_file[len(file_prefix):]
session = cls(session_key)
# When an expired session is loaded, its file is removed, and a
# new file is immediately created. Prevent this by disabling
# the create() method.
session.create = lambda: None
session.load()
@@ -0,0 +1,36 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# F Wolff <friedel@translate.org.za>, 2019
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2019-01-04 18:57+0000\n"
"Last-Translator: F Wolff <friedel@translate.org.za>\n"
"Language-Team: Afrikaans (http://www.transifex.com/django/django/language/"
"af/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: af\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr "Sessies"
msgid "session key"
msgstr "sessiesleutel"
msgid "session data"
msgstr "sessiedata"
msgid "expire date"
msgstr "vervaldatum"
msgid "session"
msgstr "sessie"
msgid "sessions"
msgstr "sessies"
@@ -0,0 +1,37 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Ali Ismayilov <ali@ismailov.info>, 2011
# Emin Mastizada <emin@linux.com>, 2018
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2018-04-27 13:19+0000\n"
"Last-Translator: Emin Mastizada <emin@linux.com>\n"
"Language-Team: Azerbaijani (http://www.transifex.com/django/django/language/"
"az/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: az\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr "Seanslar"
msgid "session key"
msgstr "seans açarı"
msgid "session data"
msgstr "seansın məlumatları"
msgid "expire date"
msgstr "bitmə tarixi"
msgid "session"
msgstr "seans"
msgid "sessions"
msgstr "seanslar"
@@ -0,0 +1,37 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: Bosnian (http://www.transifex.com/django/django/language/"
"bs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: bs\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
msgid "Sessions"
msgstr ""
msgid "session key"
msgstr "ključ sesije"
msgid "session data"
msgstr "podaci sesije"
msgid "expire date"
msgstr "datum isteka"
msgid "session"
msgstr "sesija"
msgid "sessions"
msgstr "sesije"
@@ -0,0 +1,36 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
# Vláďa Macek <macek@sandbox.cz>, 2014
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: Czech (http://www.transifex.com/django/django/language/cs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: cs\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
msgid "Sessions"
msgstr "Sezení"
msgid "session key"
msgstr "klíč sezení"
msgid "session data"
msgstr "data sezení"
msgid "expire date"
msgstr "datum expirace"
msgid "session"
msgstr "sezení"
msgid "sessions"
msgstr "sezení"
@@ -0,0 +1,36 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Erik Wognsen <r4mses@gmail.com>, 2014
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: Danish (http://www.transifex.com/django/django/language/da/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: da\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr "Sessioner"
msgid "session key"
msgstr "sessionsnøgle"
msgid "session data"
msgstr "sessionsdata"
msgid "expire date"
msgstr "udløbsdato"
msgid "session"
msgstr "session"
msgid "sessions"
msgstr "sessioner"
@@ -0,0 +1,36 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
# Pãnoș <panos.laganakos@gmail.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-23 18:54+0000\n"
"Last-Translator: Pãnoș <panos.laganakos@gmail.com>\n"
"Language-Team: Greek (http://www.transifex.com/django/django/language/el/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: el\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr "Συνεδρίες"
msgid "session key"
msgstr "κλειδί συνεδρίας"
msgid "session data"
msgstr "δεδομένα συνεδρίας"
msgid "expire date"
msgstr "ημερομηνία λήξης"
msgid "session"
msgstr "συνεδρία"
msgid "sessions"
msgstr "συνεδρίες"
@@ -0,0 +1,38 @@
# This file is distributed under the same license as the Django package.
#
msgid ""
msgstr ""
"Project-Id-Version: Django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2010-05-13 15:35+0200\n"
"Last-Translator: Django team\n"
"Language-Team: English <en@li.org>\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: contrib/sessions/apps.py:8
msgid "Sessions"
msgstr ""
#: contrib/sessions/models.py:44
msgid "session key"
msgstr ""
#: contrib/sessions/models.py:46
msgid "session data"
msgstr ""
#: contrib/sessions/models.py:47
msgid "expire date"
msgstr ""
#: contrib/sessions/models.py:52
msgid "session"
msgstr ""
#: contrib/sessions/models.py:53
msgid "sessions"
msgstr ""
@@ -0,0 +1,36 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Ross Poulton <ross@rossp.org>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: English (United Kingdom) (http://www.transifex.com/django/"
"django/language/en_GB/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: en_GB\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr ""
msgid "session key"
msgstr "session key"
msgid "session data"
msgstr "session data"
msgid "expire date"
msgstr "expire date"
msgid "session"
msgstr "session"
msgid "sessions"
msgstr "sessions"
@@ -0,0 +1,37 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Ernesto Avilés Vázquez <whippiii@gmail.com>, 2014
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: Spanish (http://www.transifex.com/django/django/language/"
"es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr "Sesiones"
msgid "session key"
msgstr "clave de sesión"
msgid "session data"
msgstr "datos de sesión"
msgid "expire date"
msgstr "fecha de caducidad"
msgid "session"
msgstr "sesión"
msgid "sessions"
msgstr "sesiones"
@@ -0,0 +1,36 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Carlos Muñoz <cmuozdiaz@outlook.com>, 2015
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 22:00+0000\n"
"Last-Translator: Carlos Muñoz <cmuozdiaz@outlook.com>\n"
"Language-Team: Spanish (Colombia) (http://www.transifex.com/django/django/"
"language/es_CO/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es_CO\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr "Sesiones"
msgid "session key"
msgstr "clave de sesión"
msgid "session data"
msgstr "datos de sesión"
msgid "expire date"
msgstr "fecha de caducidad"
msgid "session"
msgstr "sesión"
msgid "sessions"
msgstr "sesiones"
@@ -0,0 +1,35 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2014-10-05 20:12+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: Spanish (Venezuela) (http://www.transifex.com/projects/p/"
"django/language/es_VE/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es_VE\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr ""
msgid "session key"
msgstr ""
msgid "session data"
msgstr ""
msgid "expire date"
msgstr ""
msgid "session"
msgstr ""
msgid "sessions"
msgstr ""
@@ -0,0 +1,36 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Claude Paroz <claude@2xlibre.net>, 2014
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: French (http://www.transifex.com/django/django/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid "Sessions"
msgstr "Sessions"
msgid "session key"
msgstr "clé de session"
msgid "session data"
msgstr "données de session"
msgid "expire date"
msgstr "date d'expiration"
msgid "session"
msgstr "session"
msgid "sessions"
msgstr "sessions"
@@ -0,0 +1,36 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: Icelandic (http://www.transifex.com/django/django/language/"
"is/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: is\n"
"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n"
msgid "Sessions"
msgstr ""
msgid "session key"
msgstr "setulykill"
msgid "session data"
msgstr "setugögn"
msgid "expire date"
msgstr "fyrningardagsetning"
msgid "session"
msgstr "seta"
msgid "sessions"
msgstr "setur"
@@ -0,0 +1,36 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: Georgian (http://www.transifex.com/django/django/language/"
"ka/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ka\n"
"Plural-Forms: nplurals=1; plural=0;\n"
msgid "Sessions"
msgstr ""
msgid "session key"
msgstr "სესიის გასაღები"
msgid "session data"
msgstr "სესიის მონაცემები"
msgid "expire date"
msgstr "ამოწურვის თარიღი"
msgid "session"
msgstr "სესია"
msgid "sessions"
msgstr "სესიები"
@@ -0,0 +1,36 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
# Chr0m3 <chr0m3.kr@gmail.com>, 2015
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translator: Chr0m3 <chr0m3.kr@gmail.com>\n"
"Language-Team: Korean (http://www.transifex.com/django/django/language/ko/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ko\n"
"Plural-Forms: nplurals=1; plural=0;\n"
msgid "Sessions"
msgstr "세션"
msgid "session key"
msgstr "세션 키"
msgid "session data"
msgstr "세션 날짜"
msgid "expire date"
msgstr "유효날짜"
msgid "session"
msgstr "세션"
msgid "sessions"
msgstr "세션"
@@ -0,0 +1,35 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2014-10-05 20:12+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: Luxembourgish (http://www.transifex.com/projects/p/django/"
"language/lb/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: lb\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr ""
msgid "session key"
msgstr ""
msgid "session data"
msgstr ""
msgid "expire date"
msgstr ""
msgid "session"
msgstr ""
msgid "sessions"
msgstr ""
@@ -0,0 +1,35 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2014-10-05 20:12+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: Marathi (http://www.transifex.com/projects/p/django/language/"
"mr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: mr\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr ""
msgid "session key"
msgstr ""
msgid "session data"
msgstr ""
msgid "expire date"
msgstr ""
msgid "session"
msgstr ""
msgid "sessions"
msgstr ""
@@ -0,0 +1,36 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: Norwegian Nynorsk (http://www.transifex.com/django/django/"
"language/nn/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: nn\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr ""
msgid "session key"
msgstr "sesjonsnøkkel"
msgid "session data"
msgstr "sesjonsdata"
msgid "expire date"
msgstr "utløpsdato"
msgid "session"
msgstr "sesjon"
msgid "sessions"
msgstr "sesjonar"
@@ -0,0 +1,36 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Soslan Khubulov <inactive+soslan@transifex.com>, 2013
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:58+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: Ossetic (http://www.transifex.com/django/django/language/"
"os/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: os\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr ""
msgid "session key"
msgstr "сессийы амонӕн"
msgid "session data"
msgstr "сессийы рардтӕ"
msgid "expire date"
msgstr "фӕуды афон"
msgid "session"
msgstr "сесси"
msgid "sessions"
msgstr "сесситӕ"
@@ -0,0 +1,39 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
# Mattia Procopio <promat85@gmail.com>, 2014
# Tomasz Kajtoch <tomekkaj@tomekkaj.pl>, 2016
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-23 18:54+0000\n"
"Last-Translator: Tomasz Kajtoch <tomekkaj@tomekkaj.pl>\n"
"Language-Team: Polish (http://www.transifex.com/django/django/language/pl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pl\n"
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n"
"%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n"
"%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
msgid "Sessions"
msgstr "Sesje"
msgid "session key"
msgstr "klucz sesji"
msgid "session data"
msgstr "dane sesji"
msgid "expire date"
msgstr "data wygaśnięcia sesji"
msgid "session"
msgstr "sesja"
msgid "sessions"
msgstr "sesje"
@@ -0,0 +1,37 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
# Raúl Pedro Fernandes Santos, 2014
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-23 18:54+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: Portuguese (http://www.transifex.com/django/django/language/"
"pt/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pt\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr "Sessões"
msgid "session key"
msgstr "chave da sessão"
msgid "session data"
msgstr "dados da sessão"
msgid "expire date"
msgstr "data de expiração"
msgid "session"
msgstr "sessão"
msgid "sessions"
msgstr "sessões"
@@ -0,0 +1,37 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Allisson Azevedo <allisson@gmail.com>, 2014
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-23 18:54+0000\n"
"Last-Translator: andrewsmedina <andrewsmedina@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/django/django/"
"language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid "Sessions"
msgstr "Sessões"
msgid "session key"
msgstr "chave da sessão"
msgid "session data"
msgstr "dados da sessão"
msgid "expire date"
msgstr "data de expiração"
msgid "session"
msgstr "sessão"
msgid "sessions"
msgstr "sessões"
@@ -0,0 +1,38 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
# zejn <zejn@kiberpipa.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-23 18:54+0000\n"
"Last-Translator: Primož Verdnik <primoz.verdnik@gmail.com>\n"
"Language-Team: Slovenian (http://www.transifex.com/django/django/language/"
"sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
"%100==4 ? 2 : 3);\n"
msgid "Sessions"
msgstr "Seje"
msgid "session key"
msgstr "ključ seje"
msgid "session data"
msgstr "podatki seje"
msgid "expire date"
msgstr "čas preteka"
msgid "session"
msgstr "seja"
msgid "sessions"
msgstr "seje"
@@ -0,0 +1,38 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Branko Kokanovic <branko@kokanovic.org>, 2018
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2018-01-30 10:08+0000\n"
"Last-Translator: Branko Kokanovic <branko@kokanovic.org>\n"
"Language-Team: Serbian (http://www.transifex.com/django/django/language/"
"sr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: sr\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
msgid "Sessions"
msgstr "Сесије"
msgid "session key"
msgstr "кључ сесије"
msgid "session data"
msgstr "подаци сесије"
msgid "expire date"
msgstr "датум застаревања"
msgid "session"
msgstr "сесија"
msgid "sessions"
msgstr "сесије"
@@ -0,0 +1,38 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Igor Jerosimić, 2019
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2019-06-27 12:40+0000\n"
"Last-Translator: Igor Jerosimić\n"
"Language-Team: Serbian (Latin) (http://www.transifex.com/django/django/"
"language/sr@latin/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: sr@latin\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
msgid "Sessions"
msgstr "Sesije"
msgid "session key"
msgstr "ključ sesije"
msgid "session data"
msgstr "podaci sesije"
msgid "expire date"
msgstr "datum zastarevanja"
msgid "session"
msgstr "sesija"
msgid "sessions"
msgstr "sesije"
@@ -0,0 +1,35 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: Tamil (http://www.transifex.com/django/django/language/ta/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ta\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr ""
msgid "session key"
msgstr "அமர்வு குறியீ"
msgid "session data"
msgstr "அமர்வு தகவல்"
msgid "expire date"
msgstr "காலாவதியாகும் தேதி"
msgid "session"
msgstr "அமர்வு"
msgid "sessions"
msgstr "அமர்வுகள்"
@@ -0,0 +1,36 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# bhaskar teja yerneni <prudhviy@gmail.com>, 2011
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: Telugu (http://www.transifex.com/django/django/language/te/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: te\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Sessions"
msgstr ""
msgid "session key"
msgstr "భాగము తాళంచెవి"
msgid "session data"
msgstr "భాగము దత్తం"
msgid "expire date"
msgstr "కాలం చెల్లు తేది."
msgid "session"
msgstr "భాగము"
msgid "sessions"
msgstr "భాగములు"
@@ -0,0 +1,36 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
# Kowit Charoenratchatabhan <kowit.s.c@gmail.com>, 2018
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2018-05-06 07:45+0000\n"
"Last-Translator: Kowit Charoenratchatabhan <kowit.s.c@gmail.com>\n"
"Language-Team: Thai (http://www.transifex.com/django/django/language/th/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: th\n"
"Plural-Forms: nplurals=1; plural=0;\n"
msgid "Sessions"
msgstr "เซสชัน"
msgid "session key"
msgstr "เซสชันคีย์"
msgid "session data"
msgstr "ข้อมูลเซสชัน"
msgid "expire date"
msgstr "วันหมดอายุ"
msgid "session"
msgstr "เซสชัน"
msgid "sessions"
msgstr "เซสชัน"
@@ -0,0 +1,38 @@
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
# Thanh Le Viet <lethanhx2k@gmail.com>, 2013
# Tran Van <vantxm@yahoo.co.uk>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-23 18:54+0000\n"
"Last-Translator: Tran Van <vantxm@yahoo.co.uk>\n"
"Language-Team: Vietnamese (http://www.transifex.com/django/django/language/"
"vi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: vi\n"
"Plural-Forms: nplurals=1; plural=0;\n"
msgid "Sessions"
msgstr ""
msgid "session key"
msgstr "session key"
msgid "session data"
msgstr "session data"
msgid "expire date"
msgstr "Ngày hết hạn"
msgid "session"
msgstr "Phiên"
msgid "sessions"
msgstr "session"
@@ -0,0 +1,19 @@
from importlib import import_module
from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = (
"Can be run as a cronjob or directly to clean out expired sessions "
"(only with the database backend at the moment)."
)
def handle(self, **options):
engine = import_module(settings.SESSION_ENGINE)
try:
engine.SessionStore.clear_expired()
except NotImplementedError:
self.stderr.write("Session engine '%s' doesn't support clearing "
"expired sessions.\n" % settings.SESSION_ENGINE)
@@ -0,0 +1,35 @@
from django.contrib.sessions.base_session import (
AbstractBaseSession, BaseSessionManager,
)
class SessionManager(BaseSessionManager):
use_in_migrations = True
class Session(AbstractBaseSession):
"""
Django provides full support for anonymous sessions. The session
framework lets you store and retrieve arbitrary data on a
per-site-visitor basis. It stores data on the server side and
abstracts the sending and receiving of cookies. Cookies contain a
session ID -- not the data itself.
The Django sessions framework is entirely cookie-based. It does
not fall back to putting session IDs in URLs. This is an intentional
design decision. Not only does that behavior make URLs ugly, it makes
your site vulnerable to session-ID theft via the "Referer" header.
For complete documentation on using Sessions in your code, consult
the sessions documentation that is shipped with Django (also available
on the Django Web site).
"""
objects = SessionManager()
@classmethod
def get_session_store_class(cls):
from django.contrib.sessions.backends.db import SessionStore
return SessionStore
class Meta(AbstractBaseSession.Meta):
db_table = 'django_session'