mirror of
https://github.com/jazzband/django-constance.git
synced 2026-05-01 12:14:53 +00:00
parent
590fa02eb3
commit
b62206da57
4 changed files with 17 additions and 1 deletions
1
AUTHORS
1
AUTHORS
|
|
@ -41,3 +41,4 @@ vl <1844144@gmail.com>
|
|||
vl <vl@u64.(none)>
|
||||
Dmitriy Tatarkin <mail@dtatarkin.ru>
|
||||
Alexandr Artemyev <mogost@gmail.com>
|
||||
Elisey Zanko <elisey.zanko@gmail.com>
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class RedisBackend(Backend):
|
|||
|
||||
def set(self, key, value):
|
||||
old_value = self.get(key)
|
||||
self._rd.set(self.add_prefix(key), dumps(value))
|
||||
self._rd.set(self.add_prefix(key), dumps(value, protocol=settings.REDIS_PICKLE_VERSION))
|
||||
signals.config_updated.send(
|
||||
sender=config, key=key, old_value=old_value, new_value=value
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import pickle
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
BACKEND = getattr(
|
||||
|
|
@ -36,6 +38,8 @@ REDIS_CONNECTION_CLASS = getattr(
|
|||
|
||||
REDIS_CONNECTION = getattr(settings, 'CONSTANCE_REDIS_CONNECTION', {})
|
||||
|
||||
REDIS_PICKLE_VERSION = getattr(settings, 'CONSTANCE_REDIS_PICKLE_VERSION', pickle.DEFAULT_PROTOCOL)
|
||||
|
||||
SUPERUSER_ONLY = getattr(settings, 'CONSTANCE_SUPERUSER_ONLY', True)
|
||||
|
||||
IGNORE_ADMIN_VERSION_CHECK = getattr(
|
||||
|
|
|
|||
|
|
@ -66,6 +66,17 @@ database. Defaults to ``'constance:'``. E.g.::
|
|||
|
||||
CONSTANCE_REDIS_PREFIX = 'constance:myproject:'
|
||||
|
||||
``CONSTANCE_REDIS_PICKLE_VERSION``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The (optional) protocol version of pickle you want to use to serialize your python
|
||||
objects when storing in the Redis database. Defaults to ``pickle.DEFAULT_PROTOCOL``. E.g.::
|
||||
|
||||
CONSTANCE_REDIS_PICKLE_VERSION = pickle.DEFAULT_PROTOCOL
|
||||
|
||||
You might want to pin this value to a specific protocol number, since ``pickle.DEFAULT_PROTOCOL``
|
||||
means different things between versions of Python.
|
||||
|
||||
Database
|
||||
--------
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue