-
-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify #175
Conversation
Codecov Report
@@ Coverage Diff @@
## master #175 +/- ##
==========================================
+ Coverage 94.92% 96.84% +1.92%
==========================================
Files 16 16
Lines 768 698 -70
Branches 65 56 -9
==========================================
- Hits 729 676 -53
+ Misses 29 16 -13
+ Partials 10 6 -4
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some questions of some bits that are not clear.
4527600 looks good, I can go ahead and merge that single commit in the meantime.
Oh, darn, I can't merge 4527600 since merging into this repository is only allowed by creating a separate PR. I'll merge them all together when all patches have are ready. |
I have responded to your questions. If I have done so to your satisfaction, please resolve them. Otherwise I'm happy to answer additional questions or explain what's going on in a bit more detail. The interplay in the middleware and backends between Django's superclasses and ours can be a little complicated, so please take your time and ask for whatever explanations you need. I realize that this PR is quite a big change and while I'd like to see it merged, I'm trying very hard to not be pushy about it. 😄 There is an argument to be made that our previous code was much more easily understandable than the current code, even though it duplicated a lot of code from Django. However, since it doesn't seem like this project has tons of attention paid to it, reducing the amount of code we have to maintain in this project and relying on subclassing Django objects is a worthwhile tradeoff in my opinion, even if it does make the code slightly more difficult to figure out what it's doing. |
I added a few more comments to give some pointers as to where certain methods are used by methods on the superclass. Happy to add more if they'll be useful or helpful. |
Using some of the code from Django, we can greatly simplify and even remove some of our code.
Description
process_response
at all, since it wasn't materially different from Django'sget_model_class
to import and use ourSession
model, which allows other methods (including ones from the superclass) to useself.model
self.model
instead of our ownSession
model directlyexists
method entirely (which will use Django's)_get_session_from_db
, so we can remove theload
methodcreate
methodcreate_model_instance
so we don't have to define our ownsave
methoddelete
andclear_expired
methodsMotivation and Context
We duplicated a lot of code from
django.contrib.sessions
. The less code we duplicate, the less code we have to maintain ourselves.This might also make it easier to add a
cached_db
backend similar to Django's.How Has This Been Tested?
Normal tests.
Types of changes
Checklist: