django-hashid-field
django-hashid-field copied to clipboard
Include internal hashid state into the picking state
I hit the same issue as in #55 with django-cacheops and django-hashid-field.
Unfortunately for me, that enable_hashid_object=False "workaround" can't be applied in my case, but I've found that if you include self._hashids attribute into the pickled state, hashid objects can be successfully deserialized from the cache provided by django-cacheops.
As a side thought: the actual fix might be that some other attribute is now excluded from the pickled representation, but I'm not exactly sure what else can affect this behavior in here.
Please note that this is a breaking change as it changes pickling behavior.
My apologies, I'm converting it back to draft to ensure that this change works correctly
Just a note that I haven't missed or forgotten this, just haven't had time to do a deep dive into what's going on with django-cacheops. However, pickling the _hashids object (which is an instance of the Hashids library object) doesn't have the right smell. But I could be wrong. Won't know until I have some time to dedicated to this. Hopefully soon.
I have merged this in, and tested the behavior of unpickling old pickled objects, and it looks like it's fully backwards compatible. So unpickling should no longer need to recompute the hashid. Sorry for the delay.