summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander2021-12-23 18:01:31 +0000
committerMagnus Hagander2021-12-23 18:04:29 +0000
commit0443c9c3db42db8ded9a36c90f7495f5884a1cf3 (patch)
tree2623732e6306bc8a60881f8119bb7c599e3fa194
parentd38c7e5237073e41abae530c4f93d0d3a976f681 (diff)
Disable workaround for pickling as of Django 3.2.10FINAL_DJANGO22
In fixing a completely unrelated regression, Django 3.2.10 (the minor release) seems to have removed the need for our workaround for pickling memoryviews. So make this an explicit check, and don't make the conversion if not needed.
-rw-r--r--postgresqleu/confreg/models.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/postgresqleu/confreg/models.py b/postgresqleu/confreg/models.py
index b999dc5f..5b5837a3 100644
--- a/postgresqleu/confreg/models.py
+++ b/postgresqleu/confreg/models.py
@@ -926,7 +926,9 @@ class Speaker(models.Model):
r = super(Speaker, self).__reduce_ex__(protocol)
# Ooh, this is ugly. But this is to ensure that the 'photo' part of the
# pickled value works (because memoryviews can't be pickled)
- if isinstance(r[2]['photo'], memoryview):
+ # NOTE! This appears to have been fixed in Django 3.2.10 (yes, minor release!), thus breaking
+ # our fix. So make the fix conditional until we have 3.2.10 everywhere so we can throw it away
+ if 'photo' in r[2] and isinstance(r[2]['photo'], memoryview):
r[2]['photo'] = bytes(r[2]['photo'])
return r