chore: Upgrade to Django 4.2 - #5665
Conversation
pkg_resources warning is caused by a few packages (django-simple-history. django-widget-tweaks, etc). The datetime_safe warning is in tastypie, as indicated. The others are deprecated settings we already have tickets for.
PickleSerializer is deprecated
(the "Sign out" link is now a submit button)
bytes are incompatible with JSONSerializer
I do not know enough about how the system works, but let me raise the issue. The NomCom private key isn't characters, it's an array of bytes and trying to make it into and out-of UTF8 is probably not safe. If you need to turn key material into json, the best thing is to do to/from base64. Hope this helps. |
Thanks for the comment - I think it's in encrypted, ascii-armored state (i.e., already base64 coded) when it's put in the session store. In the tests, the value in the session is faked with this: datatracker/ietf/nomcom/factories.py Line 37 in 23ca7a9 In actual operation, it's stored here datatracker/ietf/nomcom/utils.py Line 197 in 23ca7a9 and retrieved here datatracker/ietf/nomcom/utils.py Line 180 in 23ca7a9 (the first The output of that command that was being handled as |
Codecov Report
@@ Coverage Diff @@
## feat/django4 #5665 +/- ##
=============================================
Coverage 88.73% 88.73%
=============================================
Files 287 287
Lines 39869 39876 +7
=============================================
+ Hits 35378 35385 +7
Misses 4491 4491
|
| command_line_safe_secret(settings.NOMCOM_APP_SECRET) | ||
| ), | ||
| private_key | ||
| private_key.encode("utf8") |
There was a problem hiding this comment.
I don't think this is going to work. The nomcom private key is part of a keypair that is generated externally, and the byte sequence is not guaranteed to be valid utf8. Maybe uuencoding first would work around the issue?
Please also check that the instructions (and explanations) at https://github.com/ietf-tools/datatracker/blob/main/ietf/templates/nomcom/chair_help.html#L9-L76 are still accurate.
There was a problem hiding this comment.
Sorry - I hadn't seen the exchange with Rich
There was a problem hiding this comment.
This should not change anything with respect to the instructions or explanations. The change here is only in handling the data that comes back from gpg openssl. As long as the reverse operation is done when feeding it back to gpg openssl to decrypt, it should be transparent.
I will see about switching it for a more robust handling of arbitrary bytes, otherwise someone somewhere will change a locale and we'll get a weird bug.
This brings us to the current version of Django.
Tests all pass and all but one deprecation warning have been resolved or suppressed after creating a ticket to track eventual resolution. The one exception, caused by a GET to the OIDC end-session view, will need to be resolved in
django-oidc-providerand has simply been suppressed. When we get to Django 5, we should re-enable the warning and run tests to be sure we are clear of the problem.A few significant changes:
The session serializer has been changed to
JSONSerializer. There was one problem with this - the nomcom private key was being stored in the session asbytes, which cannot be serialized directly as JSON. I fixed this by decoding as utf8 before stuffing into the session and encoding as utf8 when retrieving.Django 5 will change the default rendering of formsets to use a div-based structure. I've opted in to adopting this change early by setting
FORM_RENDERERinsettings.py. I checked a few places to see that this did not affect our views, but we should probably check more thoroughly. Hopefully the test crawl will catch problems if there are any.Logging out via GET has been deprecated. The "Sign out" button in the dropdown menu has been changed to a form with a button to POST to the logout view. This worked without needing to modify CSS, but a few tests that counted the number of forms or number of "submit" buttons needed to be tweaked to ignore the sign out form.