mirror of
https://github.com/Hopiu/django-cachalot.git
synced 2026-05-21 19:01:52 +00:00
Cast memoryview objects to bytes to be able to pickle them. (#163)
Fixes #125
This commit is contained in:
parent
689f679ad3
commit
d24e3b37ca
1 changed files with 4 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import copyreg
|
||||
from django import __version__ as django__version__, VERSION as django_version
|
||||
from django.apps import AppConfig
|
||||
from django.conf import settings
|
||||
|
|
@ -93,4 +94,7 @@ class CachalotConfig(AppConfig):
|
|||
name = 'cachalot'
|
||||
|
||||
def ready(self):
|
||||
# Cast memoryview objects to bytes to be able to pickle them.
|
||||
# https://docs.python.org/3/library/copyreg.html#copyreg.pickle
|
||||
copyreg.pickle(memoryview, lambda val: (memoryview, (bytes(val),)))
|
||||
cachalot_settings.load()
|
||||
|
|
|
|||
Loading…
Reference in a new issue