Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#25911 closed Bug (needsinfo)

The decorator override_settings resets SETTINGS_MODULE variable

Reported by: Vitaliy Yelnik Owned by: nobody
Component: Testing framework Version: 1.9
Severity: Normal Keywords: override_settings
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

from django.conf import UserSettingsHolder, settings

# output 'service.settings.local'
print settings.SETTINGS_MODULE

# from code override_settings
override = UserSettingsHolder(settings._wrapped)

# output None
print override.SETTINGS_MODULE

# output 'service.settings.local'
print override.default_settings.SETTINGS_MODULE

Change History (7)

comment:1 by Tim Graham, 8 years ago

Could you elaborate on why this is a problem?

comment:2 by Tim Graham, 8 years ago

Resolution: needsinfo
Status: newclosed

comment:3 by Vitaliy Yelnik, 8 years ago

I have because of this began to fall tests, as this variable is used in a third-party module

comment:4 by Tim Graham, 8 years ago

I'm not sure, but it might be viewed as intentional/correct behavior since if you're overriding some settings, you're no longer using the original settings module. I'd be interested to see how the third-party module is using the variable.

in reply to:  4 comment:5 by Vitaliy Yelnik, 8 years ago

Replying to timgraham:

I'm not sure, but it might be viewed as intentional/correct behavior since if you're overriding some settings, you're no longer using the original settings module. I'd be interested to see how the third-party module is using the variable.

Coffin: Jinja2 extensions for Django
URLExtension class, line 205

comment:6 by Tim Graham, 8 years ago

I don't find that usage a compelling reason to fix this ticket as it's based on a common convention (but not a requirement) of the structure a Django project. Also, reversing URLs by dotted path is deprecated and removed in Django 1.10.

comment:7 by Vitaliy Yelnik, 8 years ago

Maybe it's worth it to add to the documentation?

Note: See TracTickets for help on using tickets.
Back to Top