Closed Bug 1429933 Opened 7 years ago Closed 6 years ago

Eliminate RemovedInDjangoXXWarnings

Categories

(developer.mozilla.org Graveyard :: Code Cleanup, enhancement, P1)

All
Other
enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jwhitlock, Assigned: jwhitlock)

References

Details

(Whiteboard: [specification][type:bug])

What did you do?
================
In the development environment, run

PYTHONWARNINGS=all pytest kuma --capture=no -vv

What happened?
==============
Many warnings, such as:

/usr/local/lib/python2.7/site-packages/django/conf/__init__.py:122: RemovedInDjango110Warning: Session verification will become mandatory in Django 1.10. Please add 'django.contrib.auth.middleware.SessionAuthenticationMiddleware' to your MIDDLEWARE_CLASSES setting when you are ready to opt-in after reading the upgrade considerations in the 1.8 release notes.

What should have happened?
==========================
No deprecation warnings

Is there anything else we should know?
======================================
Part of the process to upgrade Django versions:

https://docs.djangoproject.com/en/1.11/howto/upgrade-version/#resolving-deprecation-warnings
Assignee: nobody → jwhitlock
Blocks: 1401246
Status: NEW → ASSIGNED
Depends on: 1255142
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/013bda7c4ce69dafb45e8d0c91bcada85fae065c
bug 1429933: Migrate to RegexField.error_messages

RegexField.error_message is deprecated, and removed in Django 1.11.
Replace it with the suggested error_messages={'invalid': msg}.

https://github.com/mozilla/kuma/commit/024f3907d5f4311edc4c36724b4fb924565ed9f9
Merge pull request #4684 from jwhitlock/error-messages-1429933

bug 1429933: Migrate to RegexField.error_messages
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/f87ab6884648c5a8d3096b643ee029a95a63af6b
bug 1429933: Add on_delete specifications

on_delete is a required attribute starting in Django 2.0, and is allowed
in Django 1.8. Some values:

* CASCADE (the default): Delete this object when the referenced object
  is deleted.
* SET_NULL: Set the reference to NULL when the referenced object is
  deleted.
* PROTECT: Deny deletion of the referenced object, forcing this object
  to be deleted first.

The on_delete attribute must be set in the model as well as the initial
migration.

https://github.com/mozilla/kuma/commit/79e24a24920e05344096e049c586ad8aecf58038
Merge pull request #4685 from jwhitlock/on-delete-1429933

bug 1429933: Add on_delete specifications
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/97f6c2b48aba4739cbd0889e88c3ac107616b58b
bug 1429933: Switch NoArgsCommand to BaseCommand

NoArgsCommand was deprecated in Django 1.8, and removed in 1.10.

https://github.com/mozilla/kuma/commit/192b366b598cfad867e513bff3c34062e6aed936
Merge pull request #4723 from jwhitlock/noargscommand-1429933

bug 1429933: Migrate NoArgsCommand to BaseCommand
Priority: -- → P1
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/c4ca7777812c4c497f647a921a60d9955cf03fd3
bug 1429933: Enable session verification

Session verification, which includes invalidating sessions after
password changes, is enabled by default in Django 1.10. We don't use
passwords, but session verification can still used, and enabling the
middleware will let us detect issues before 1.11 is used.

https://github.com/mozilla/kuma/commit/6de6c9436aebb6cd001ddcade994f1cdca668016
bug 1429933: Note when middleware can be removed

Session verification was enabled by default in Django 1.10, and the
SessionAuthenticationMiddleware, which used to enable it, now does
nothing. It can be removed in Django 1.10 and later, and is removed in
Django 2.0.

https://docs.djangoproject.com/en/2.0/releases/1.10/#features-removed-in-1-10

https://github.com/mozilla/kuma/commit/5bb24a9e4cd3ec84250050f0709b151f22933fae
Merge pull request #4751 from jwhitlock/session-verification-1429933

bug 1429933: Enable session verification
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/18a14c527f995cfb37e02b64b34d2eee1b566212
[bug 1429933] remove depreciated CELERYD_LOG_LEVEL

https://github.com/mozilla/kuma/commit/35fa39c15eb627ab3cc60ce70f61770e6765548e
Merge pull request #4748 from mashrikt/depreciation

[bug 1429933] remove depreciated CELERYD_LOG_LEVEL
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/0b0f865c3ca8be9e7c97724e2fbab4ae1dbe9598
bug 1429933: Update get_form, match upsteam class

In Django 1.8, django.views.generic.edit.FormMixin's method
get_form() changed so that form_class was no longer a required argument,
but instead calls get_form_class() if it has the default value of None.

In Django 1.8, this removes a deprecation warning.
In Django 1.10, this fixes a runtime error.

https://github.com/mozilla/kuma/commit/903d813b46d8803756d44521e2b0bb7eb59efb0c
Merge pull request #4761 from jwhitlock/form-default-1429933

bug 1429933: Update get_form to match upstream class
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/a006aa567c4ffaac5fa69e6a82cb5d335f9c0773
bug 1429933: Update context processor paths

Context processors moved from django.core.context_processors to
django.template.context_processors in Django 1.8. This removes a
deprecation warning in 1.8, and a run-time error in Django 1.10.

It also fixes a stray trailing comma in the !_NEED_DEBREACH path.

https://github.com/mozilla/kuma/commit/fd1673e9678505e5a5900d1b934a9f2ee3caadf7
Merge pull request #4763 from jwhitlock/context-processors-1429933

bug 1429933: Update context processor paths
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/8f583b5f3d36016806ff1a3f403ca61dab0dfbda
bug 1429933: Use reverse in events test

Use reverse to create the profile URL, rather than building a path in
the tests.

https://github.com/mozilla/kuma/commit/a1eb2c530df5f9167954cf7b7807dc4c13e53828
bug 1429933: Add leading slash to test client GETs

Our current middlewares are OK with paths that don't begin with a slash,
but Django 1.11-compatible middlewares will not be.

https://github.com/mozilla/kuma/commit/d37f40e4310739a000781d09a1588b846cd3cf77
bug 1429933: Remove leading slashes in urlpatterns

Django 1.11 generates warnings when there are leading slashes in
urlpatterns, and expects a trailing slash in the urlpattern that
includes it. Update the urlpatterns to match the standard, and update the
code that rejects reserved names in the /docs/ namespace.

https://github.com/mozilla/kuma/commit/4a34764593028e4f0e9e4fe66c12fe195a568eb4
Merge pull request #4764 from jwhitlock/leading-slashes-1429933

bug 1429933: Fixup URLs, urlpatterns, and tests to prepare for new LocaleMiddleware
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/99c4c94d27af5754984bbb785d78101dc195c292
bug 1429933: Avoid BaseException.message

PEP 352 makes changes to exceptions, including:
* Python 2.5 added the BaseException class.
* Python 2.6 deprecated the message attribute.
* Python 3.0 removed the message attribute.

Instead of testing exception.message, test str(exception). Also, convert
some tests to pytest style.

https://github.com/mozilla/kuma/commit/6ea5e61983b553ad81d1fce3ae119c8437c7181a
Merge pull request #4770 from jwhitlock/exception-message-1429933

bug 1429933: Avoid BaseException.message
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/d20d1e68b9eb7e3e93a00a1877e3521a0c0c8fb5
bug 1429933: Set email to empty string in test

MySQL backend warns "Warning: Column 'email' cannot be null".

https://github.com/mozilla/kuma/commit/9160ed522d40e0796c5f01a7a35e7c000520fafe
Merge pull request #4772 from jwhitlock/null-email-1429933

bug 1429933: Set email to empty string in test
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/b9aafcf8b1cafef2524d7f3ab7533d1cbe46e381
bug 1429933: Use ROOT_URLCONF, not .urls

SimpleTestCase.urls is deprecated in Django 1.8 and will be removed in
Django 1.10.

https://github.com/mozilla/kuma/commit/4097a0610e665011c0349518799bf617b13d42dc
Merge pull request #4771 from jwhitlock/simpletestcase-urls-1429933

bug 1429933: Use ROOT_URLCONF, not .urls
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/00da2a097af7896116d91668da41f157d4587f27
bug 1429933: Switch to _meta.get_field

Django 1.8 formalized the Model _meta API, and deprecated methods that
were private but in common use. Following the migration guide [1],
switch from _meta.get_field_by_name to _meta.get_field.

[1] https://docs.djangoproject.com/en/1.8/ref/models/meta/#migrating-from-the-old-api

https://github.com/mozilla/kuma/commit/a93a8119250f46d8a228d898c91483b2d17fd444
Merge pull request #4773 from jwhitlock/feeder-guid-length-1429933

bug 1429933: Switch to _meta.get_field
Depends on: 1461350
There are several deprecation warning for Django 2.0 and later, that will more easily be addressed once we are on Django 1.11. Also, Python 3 is a blocker for Django 2.0, so it will be a while before we will be ready for that. Django 2.2 is the next LTS, and is planned for April 2019. 1.11 will be a supported LTS until April 2020.

There are no deprecation warnings for Django 1.11 and below, so closing as fixed.
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
See Also: → 1467529
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.