#20922: Allow customizing the serializer used by contrib.sessions ----------------------------------+------------------------------------ Reporter: gwahl@… | Owner: timo Type: New feature | Status: assigned Component: contrib.sessions | Version: 1.5 Severity: Release blocker | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ----------------------------------+------------------------------------
Comment (by akaariai): I think the additional complexity is needed. If you happen to use two different applications that use something more complex in sessions, you will need that. Some questions: - Are model instances automatically serializable? I know they can be serialized for fixtures... - What if two hooks have same "handles_variables" keys? First one wins? Chain them? ValidationError? Something else? - If you have some object type that needs always custom serialization, but is found from different names in the session, is there any nice way to handle that using the above API? Maybe '*' variable? Or maybe there should be object hook that will be called if present (json_serialize(), json_deserialize() for example). - What about nested structures, if you happen to have object you know how to serialize deeply nested, how to proceed? Again object hooks would help here. - What happens when transitioning from Pickle to JSON? Loud failure seems like bad option, throwing session data out seems OK. I think this should be tested (unless it already is). These are not meant to be "must fix" issues, it is completely OK to answer "too complex" to some of them... In any case there will be use cases where JSON serialization will be nearly impossible. QuerySet serialization comes to mind here... -- Ticket URL: <https://code.djangoproject.com/ticket/20922#comment:4> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/077.d00a2648e49464529abd48105c55db45%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.