mirror of
https://github.com/jazzband/django-constance.git
synced 2026-03-16 22:40:24 +00:00
fix: Fixed _pickle.UnpicklingError (#576)
The error indicates an issue with unpickling data during the migration process. Specifically, it raises an `_pickle.UnpicklingError` with the message "invalid load key, '{'." The data being loaded may be corrupted or not in the expected format.
This commit is contained in:
parent
c690d5ef0f
commit
cf838ab28a
1 changed files with 4 additions and 1 deletions
|
|
@ -40,7 +40,10 @@ def migrate_pickled_data(apps, schema_editor) -> None: # pragma: no cover
|
|||
prefixed_key = f'{_prefix}{key}'
|
||||
value = _rd.get(prefixed_key)
|
||||
if value is not None:
|
||||
redis_migrated_data[prefixed_key] = dumps(pickle.loads(value)) # noqa: S301
|
||||
try:
|
||||
redis_migrated_data[prefixed_key] = dumps(pickle.loads(value)) # noqa: S301
|
||||
except pickle.UnpicklingError:
|
||||
continue
|
||||
for prefixed_key, value in redis_migrated_data.items():
|
||||
_rd.set(prefixed_key, value)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue