Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#15336 closed (fixed)

Spurious DeprecationWarning when no database settings present

Reported by: Ivan Sagalaev Owned by: Ivan Sagalaev
Component: Core (Other) Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If a db-less project doesn't set up database settings management commands produce a spurious DeprecationWarning:

django/db/__init__.py:18: DeprecationWarning: settings.DATABASE_* is deprecated; use settings.DATABASES instead.
  DeprecationWarning

This breaks running cron scripts due to cron considering any output from a program as a reason to yell into your email about something possibly broken.

The warning is raised on a single condition of empty settings.DATABASES. This is easily fixed by also checking if a deprecated settings.DATABASE_ENGINE is set. A patch is following.

Attachments (2)

15336.diff (743 bytes ) - added by Ivan Sagalaev 14 years ago.
Patch
__init__.py (4.2 KB ) - added by anonymous 13 years ago.

Download all attachments as: .zip

Change History (6)

by Ivan Sagalaev, 14 years ago

Attachment: 15336.diff added

Patch

comment:1 by Ivan Sagalaev, 14 years ago

Has patch: set

I'm not really sure how to write a test for this because tests require database settings. However the fix seems to be pretty trivial and may be we could leave out tests in this case.

comment:2 by Russell Keith-Magee, 14 years ago

Component: UncategorizedCore framework
Triage Stage: UnreviewedReady for checkin

This is inherently difficult to test, so I'm happy to accept this RFC based on inspection and manual testing.

comment:3 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

In [15571]:

Fixed #15336 -- Silenced a warning about the DATABASES transition when a database backend isn't specified. Thanks to Ivan Sagalaev for the report and patch.

comment:4 by Russell Keith-Magee, 14 years ago

In [15575]:

[1.2.X] Fixed #15336 -- Silenced a warning about the DATABASES transition when a database backend isn't specified. Thanks to Ivan Sagalaev for the report and patch.

Backport of r15571 from trunk.

by anonymous, 13 years ago

Attachment: __init__.py added
Note: See TracTickets for help on using tickets.
Back to Top