mirror of
https://github.com/jazzband/django-constance.git
synced 2026-05-04 21:54:51 +00:00
More safe suppress of pickle-to-json data migration (#578)
This commit is contained in:
parent
5ce88b7457
commit
5e221a855b
1 changed files with 6 additions and 2 deletions
|
|
@ -42,8 +42,12 @@ def migrate_pickled_data(apps, schema_editor) -> None: # pragma: no cover
|
|||
if value is not None:
|
||||
try:
|
||||
redis_migrated_data[prefixed_key] = dumps(pickle.loads(value)) # noqa: S301
|
||||
except pickle.UnpicklingError:
|
||||
continue
|
||||
except pickle.UnpicklingError as e:
|
||||
if value.startswith(b'{"__'):
|
||||
# Seems like we're facing already migrated data
|
||||
# Might be related to defaults and when config was accessed while django inits for migration
|
||||
continue
|
||||
raise e
|
||||
for prefixed_key, value in redis_migrated_data.items():
|
||||
_rd.set(prefixed_key, value)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue