[Django] #25911: The decorator override_settings resets SETTINGS_MODULE variable

6 views
Skip to first unread message

Django

unread,
Dec 10, 2015, 11:50:44 AM12/10/15
to django-...@googlegroups.com
#25911: The decorator override_settings resets SETTINGS_MODULE variable
-----------------------------------+-------------------------------
Reporter: kwist | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.9
Severity: Normal | Keywords: override_settings
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+-------------------------------
{{{#!python
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
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25911>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 10, 2015, 12:33:12 PM12/10/15
to django-...@googlegroups.com
#25911: The decorator override_settings resets SETTINGS_MODULE variable
-----------------------------------+--------------------------------------

Reporter: kwist | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.9
Severity: Normal | Resolution:

Keywords: override_settings | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Could you elaborate on why this is a problem?

--
Ticket URL: <https://code.djangoproject.com/ticket/25911#comment:1>

Django

unread,
Dec 12, 2015, 11:02:24 AM12/12/15
to django-...@googlegroups.com
#25911: The decorator override_settings resets SETTINGS_MODULE variable
-----------------------------------+--------------------------------------
Reporter: kwist | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.9
Severity: Normal | Resolution: needsinfo

Keywords: override_settings | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => needsinfo


--
Ticket URL: <https://code.djangoproject.com/ticket/25911#comment:2>

Django

unread,
Dec 15, 2015, 4:29:04 AM12/15/15
to django-...@googlegroups.com
#25911: The decorator override_settings resets SETTINGS_MODULE variable
-----------------------------------+--------------------------------------
Reporter: kwist | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.9
Severity: Normal | Resolution: needsinfo

Keywords: override_settings | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by kwist):

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

--
Ticket URL: <https://code.djangoproject.com/ticket/25911#comment:3>

Django

unread,
Dec 15, 2015, 7:46:43 AM12/15/15
to django-...@googlegroups.com
#25911: The decorator override_settings resets SETTINGS_MODULE variable
-----------------------------------+--------------------------------------
Reporter: kwist | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.9
Severity: Normal | Resolution: needsinfo

Keywords: override_settings | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/25911#comment:4>

Django

unread,
Dec 15, 2015, 7:54:29 AM12/15/15
to django-...@googlegroups.com
#25911: The decorator override_settings resets SETTINGS_MODULE variable
-----------------------------------+--------------------------------------
Reporter: kwist | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.9
Severity: Normal | Resolution: needsinfo

Keywords: override_settings | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by kwist):

Replying to [comment:4 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
[https://github.com/coffin/coffin/blob/master/coffin/common.py#L205
URLExtension class, line 205]

--
Ticket URL: <https://code.djangoproject.com/ticket/25911#comment:5>

Django

unread,
Dec 15, 2015, 10:01:56 AM12/15/15
to django-...@googlegroups.com
#25911: The decorator override_settings resets SETTINGS_MODULE variable
-----------------------------------+--------------------------------------
Reporter: kwist | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.9
Severity: Normal | Resolution: needsinfo

Keywords: override_settings | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by timgraham):

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,
[https://docs.djangoproject.com/en/1.9/releases/1.8/#passing-a-dotted-
path-to-reverse-and-url reversing URLs by dotted path is deprecated] and
removed in Django 1.10.

--
Ticket URL: <https://code.djangoproject.com/ticket/25911#comment:6>

Django

unread,
Dec 17, 2015, 9:31:26 AM12/17/15
to django-...@googlegroups.com
#25911: The decorator override_settings resets SETTINGS_MODULE variable
-----------------------------------+--------------------------------------
Reporter: kwist | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.9
Severity: Normal | Resolution: needsinfo

Keywords: override_settings | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by kwist):

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

--
Ticket URL: <https://code.djangoproject.com/ticket/25911#comment:7>

Reply all
Reply to author
Forward
0 new messages