core (memory/sqla_mapping): fix legacy pickled values:
folloing packages refactoring, legacy pickled values could not be unpickled (due to use of old classes). This temporary workaround fix it, but the right thing to do will be to move from pickle to JSON at some point.
This commit is contained in:
parent
0fa0b3a5f6
commit
bf9db70bee
1 changed files with 9 additions and 1 deletions
|
|
@ -102,7 +102,15 @@ class LegacyPickle(TypeDecorator):
|
|||
except AttributeError:
|
||||
pass
|
||||
# "utf-8" encoding is needed to handle Python 2 pickled data
|
||||
return pickle.loads(value, encoding="utf-8")
|
||||
try:
|
||||
return pickle.loads(value, encoding="utf-8")
|
||||
except ModuleNotFoundError:
|
||||
# FIXME: workaround due to package renaming, need to move all pickle code to
|
||||
# JSON
|
||||
return pickle.loads(
|
||||
value.replace(b"sat.plugins", b"libervia.backend.plugins"),
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
|
||||
class Json(TypeDecorator):
|
||||
|
|
|
|||
Loading…
Reference in a new issue