Changes between Initial Version and Version 3 of Ticket #20922

08/19/2013 09:11:03 AM (5 years ago)
Tim Graham

The plan is to introduce settings.SESSION_SERIAZLIER in the next 1.5.x release. It'll default to using pickle for backwards compatibility, but the default will switch to using JSON in 1.6. Pull request in progress.

An additional API has been proposed by @apollo13 to allow customizing the serializiers a bit easier (rather than dealing with subclassing the current serializers, having to possibly write mixins, etc.). For example, in the existing patch JSONMessagesSerializer could be replaced by a hook:

class SerializerHook(object):
  handles_variables = ['variable1', ...]

  def to_primitive(self, name, object):

 def from_primitive(self, name, object):

Then in you'd have another setting:

SESSION_SERIALIZER_HOOKS = ['django.contrib.messages.session_hook', ...]

This would allow 3rd party applications to provide simple hooks for their session stuff (although that should be rare since you generally don't put that much logic into sessions, messages are one example of where you still might wanna do it).

Feedback on whether or not this additional complexity is worthwhile would be appreciated.


  • Ticket #20922

    • Property Status changed from new to assigned
    • Property Severity changed from Normal to Release blocker
    • Property Component changed from Uncategorized to contrib.sessions
    • Property Summary changed from Signed Cookie Session Backend Should Support Using a JSON Serializer to Allow customizing the serializer used by contrib.sessions
    • Property Owner changed from nobody to Tim Graham
    • Property Has patch set
    • Property Type changed from Uncategorized to New feature
    • Property Triage Stage changed from Unreviewed to Accepted
  • Ticket #20922 – Description

    initial v3  
    33For background, see #20444 and
    5 Patch to come shortly.
Back to Top