#22634: Making Session model and SessionStore classes more easily extendable
--------------------------------------+--------------------
Reporter: sergeykolosov | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.sessions | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
While developing a feature the involves adding an extra database field to
the `Session` model (thus creating a new session backend based on Django's
one), I faced the need to copy almost everything from `models.py`,
`backends/db.py` and `backends/cached_db.py`.
The reason why one have to do that, is the way that `Session` model is
imported and used inside `backends/db.py` and `backends/cached_db.py`, and
the way `SessionStore` class imported and used inside `models.py`.
Since the custom backend is a part of a shared package, which is intended
to be used with multiple versions of Django, it's challenging to do that
given the above.
I suggest the following changes:
* extract an abstract base model from `Session`;
* make `Session` class a property of `SessionStore` class, removing
hardcoded usages;
* make `key_prefix` a property of `SessionStore`, defaulting to
`KEY_PREFIX`;
* (anything else to make building a custom backend based on Django's one
easier).
--
Ticket URL: <https://code.djangoproject.com/ticket/22634>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/056.f68e0dff26e5adf83cc674657228e79c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.