1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Set stacklevel for the override_settings warning.

Refs #19031.
This commit is contained in:
Aymeric Augustin
2013-12-20 11:04:58 +01:00
parent 1b9cbef198
commit eabc3b6c8d
2 changed files with 9 additions and 6 deletions

View File

@@ -97,4 +97,7 @@ def file_storage_changed(**kwargs):
@receiver(setting_changed)
def complex_setting_changed(**kwargs):
if kwargs['enter'] and kwargs['setting'] in COMPLEX_OVERRIDE_SETTINGS:
warnings.warn("Overriding setting %s can lead to unexpected behaviour." % kwargs['setting'])
# Considering the current implementation of the signals framework,
# stacklevel=5 shows the line containing the override_settings call.
warnings.warn("Overriding setting %s can lead to unexpected behaviour."
% kwargs['setting'], stacklevel=5)