django_evolution.compat.picklers
Compatibility methods for pickle operations.
Functions
|
Return a pickled representation of an object. |
|
Return the unpickled data from a pickle payload. |
Classes
|
Unpickler compatible with changes to Django class/module paths. |
|
Compatibility for unpickling a SortedDict. |
- class django_evolution.compat.picklers.SortedDict(*args, **kwargs)
Bases:
dictCompatibility for unpickling a SortedDict.
Old signatures may use an old Django
SortedDictstructure, which does not exist in modern versions. This changes any construction of this data structure into acollections.OrderedDict.- static __new__(cls, *args, **kwargs)
Construct an instance of the class.
- Parameters:
- Returns:
The new instance.
- Return type:
- class django_evolution.compat.picklers.DjangoCompatUnpickler(file, *, fix_imports=True, encoding='ASCII', errors='strict', buffers=None)
Bases:
_UnpicklerUnpickler compatible with changes to Django class/module paths.
This provides compatibility across Django versions for various field types, updating referenced module paths for fields to a standard location so that the fields can be located on all Django versions.
- find_class(module, name)
Return the class for a given module and class name.
If looking up a class from
django.db.models.fields, the class will instead be looked up fromdjango.db.models, fixing lookups on some Django versions.- Parameters:
- Returns:
The resulting class.
- Return type:
- Raises:
AttributeError – The class could not be found in the module.
- django_evolution.compat.picklers.pickle_dumps(obj)
Return a pickled representation of an object.
This will always use Pickle protocol 0, which is the default on Python 2, for compatibility across Python 2 and 3.
Changed in version 3.0: Moved from
django_evolution.compat.py23.