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
Update Buggy Code in Advance of Python 3 Update #3457
Conversation
… of https://github.com/refinery-platform/refinery-platform into ilan-gold/fix_problematic_python2_code
refinery/core/views.py
Outdated
if not request.user.has_perm('core.read_meta_dataset', data_set): | ||
try: | ||
perms = request.user.has_perm('core.read_meta_dataset', data_set) | ||
except User.DoesNotExist: |
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.
If the user is not logged in, they are the anon user. What's throwing the exception exactly?
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 believe this has to do with the way in which the logged-in user is held in browser vs. what is happening on the backend - the browser still has everything it needs to have the permission/User but the User has been logged out already in the backend so when the cached user in the browser comes through, Django uses the load of it from the cache but can then not find it once inside the application logic.
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.
so this is indeed what appears to be happening in the Authentication middleware (i imagine little changed from 1.8 to 1.9 regarding this - check out the get_user function: https://github.com/django/django/blob/1.9/django/contrib/auth/middleware.py)
Codecov Report
@@ Coverage Diff @@
## develop #3457 +/- ##
===========================================
+ Coverage 87.42% 87.45% +0.02%
===========================================
Files 96 96
Lines 15159 14799 -360
===========================================
- Hits 13253 12942 -311
+ Misses 1906 1857 -49
Continue to review full report at Codecov.
|
There are a few things/bugs here related to #2619 that should be fixed before updating to Python3.
test_tasks.py
test which means we are comparing None and int when_check_galaxy_history_state
runs, which is problematic in Python3 and not exactly what we want these tests to do anyway in Python2.