-
Notifications
You must be signed in to change notification settings - Fork 455
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
fix: wrap django 5 imports in try-except block #958
fix: wrap django 5 imports in try-except block #958
Conversation
4dbc1cd
to
6e5f75b
Compare
warnings.filterwarnings("ignore", category=RemovedInDjango50Warning) | ||
warnings.filterwarnings("ignore", category=RemovedInDjango51Warning) | ||
try: | ||
from django.utils.deprecation import RemovedInDjango50Warning, RemovedInDjango51Warning |
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.
Could you please just add a comment that includes the "REMOVE-AFTER-V18" string? and explain why this try/except was still needed in v17.
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.
Thanks for the very quick PR! This doesn't require a new release because it fixes the nightly branch (which will automatically get the fix). I'll merge as soon as you add the extra comment.
except ImportError: | ||
pass |
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.
except ImportError: | |
pass | |
except ImportError: | |
# REMOVE-AFTER-V18: | |
# In Quince, edx-platform uses Django 5. But on master, edx-platform still uses Django 3. | |
# So, Tutor v17 needs to silence these warnings, whereas Tutor v17-nightly fails to import them. | |
# Once edx-platform master is upgraded to Django 5, the try-except wrapper can be removed. | |
pass |
friendly edit -- just adding a REMOVE-AFTER comment
Merged via aa01e30 Thanks for the fix @mariajgrimaldi ! |
@regisb Oof, I just realized I merged this to nightly instead of master 🤦🏻 I guess that fine, though, since we don't need this change on master? Let me know if you'd rather I make the same change on master too, for consistency's sake. |
That's fine, there is no need to backport if the feature is not strictly necessary. But next time, please rebase instead of adding a merge commit. |
Will do. |
Description
This PR wraps Django5 warning imports in try-except blocks to avoid failures in django3 that's still in use in edx-platform's master branch. For more info on the report see: https://openedx.slack.com/archives/CGE253B7V/p1702402901252609