Skip to content

Commit

Permalink
Add meaty docstring to the serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
hmpf committed Mar 8, 2024
1 parent 4986ee8 commit 2234aa7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions python/nav/web/session_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,22 @@

class PickleSerializer:
"""
Simple wrapper around pickle to be used in signing.dumps()/loads() and
cache backends.
Simple wrapper around pickle to be used for serializing data to be put in
cookies.
This was vendored from the version found in Django 4.2. JSONSerializer has
been the default in Django since 1.6, deprecated since 4.1 and purged from
the codebase since 5.0. What Django did not provide is a migration path:
a test showed that any access of a cookie after the serializer had been
changed lead to a rather useless exception.
PickleSerializer was removed due to it being danegerous in the
signed_cookie session backend. NAV doesn't use that see we can keep the old
serializer.
Changes from the original: A deprecation warning has been removed and
a check that it is not used with the signed_cookie session backend has been
added.
"""

def __init__(self, protocol=None):
Expand Down

0 comments on commit 2234aa7

Please sign in to comment.