Code

Changes between Initial Version and Version 3 of Ticket #20922


Ignore:
Timestamp:
08/19/13 07:11:03 (11 months ago)
Author:
timo
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 Status changed from new to assigned
    • Property Severity changed from Normal to Release blocker
    • Property Patch needs improvement unset
    • Property Component changed from Uncategorized to contrib.sessions
    • Property Needs tests unset
    • 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 timo
    • Property Needs documentation unset
    • 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  
    22 
    33For background, see #20444 and https://groups.google.com/d/topic/django-developers/YwlZ9m9k1bE/discussion. 
    4  
    5 Patch to come shortly.