Changes between Initial Version and Version 3 of Ticket #20922


Ignore:
Timestamp:
Aug 19, 2013, 9:11:03 AM (11 years ago)
Author:
Tim Graham
Comment:

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):
      pass

 def from_primitive(self, name, object):
     pass

Then in settings.py 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.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #20922

    • Property Has patch set
    • Property Component Uncategorizedcontrib.sessions
    • Property Severity NormalRelease blocker
    • Property Triage Stage UnreviewedAccepted
    • Property Type UncategorizedNew feature
    • Property Owner changed from nobody to Tim Graham
    • Property Status newassigned
    • Property Summary Signed Cookie Session Backend Should Support Using a JSON SerializerAllow customizing the serializer used by contrib.sessions
  • Ticket #20922 – Description

    initial v3  
    22
    33For background, see #20444 and https://groups.google.com/d/topic/django-developers/YwlZ9m9k1bE/discussion.
    4 
    5 Patch to come shortly.
Back to Top