[Django] #26427: AttributeError for a deleted setting under @override_settings, when an Exception is raised

15 views
Skip to first unread message

Django

unread,
Mar 30, 2016, 3:38:29 PM3/30/16
to django-...@googlegroups.com
#26427: AttributeError for a deleted setting under @override_settings, when an
Exception is raised
-----------------------------------+--------------------
Reporter: master | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------
{{{
@override_settings()
class DemoTest(TestCase):
def test(self):
del settings.SOME # is in settings.py
url = reverse('viewname_with_a_non_existant_template')
self.assertRaises(TemplateDoesNotExist, self.client.get, url)
}}}
Output:
{{{
...
File "D:\Python34\lib\site-
packages\django-1.9.4-py3.4.egg\django\views\debug.py", line 294, in
get_traceback_data
'settings': get_safe_settings(),
File "D:\Python34\lib\site-
packages\django-1.9.4-py3.4.egg\django\views\debug.py", line 70, in
get_safe_settings
settings_dict[k] = cleanse_setting(k, getattr(settings, k))
File "D:\Python34\lib\site-
packages\django-1.9.4-py3.4.egg\django\conf\__init__.py", line 56, in
__getattr__
return getattr(self._wrapped, name)
File "D:\Python34\lib\site-
packages\django-1.9.4-py3.4.egg\django\conf\__init__.py", line 172, in
__getattr__
raise AttributeError
}}}
SOME is registered in {{{self._deleted}}}, but also returned by
{{{__dir__()}}} from {{{dir(self.default_settings)}}},
and so collected in {{{get_safe_settings()}}}.

Note: this is a blocking issue for me in the replacement of the deprecated
{{{SimpleTestCase.urls}}} by {{{override_settings(ROOT_URLCONF=...)}}}.

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

Django

unread,
Mar 30, 2016, 5:18:16 PM3/30/16
to django-...@googlegroups.com
#26427: AttributeError for a deleted setting under @override_settings, when an
Exception is raised
-----------------------------------+------------------------------------

Reporter: master | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_docs: => 0
* needs_better_patch: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


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

Django

unread,
Apr 23, 2016, 9:11:41 AM4/23/16
to django-...@googlegroups.com
#26427: AttributeError for a deleted setting under @override_settings, when an
Exception is raised
-------------------------------------+-------------------------------------

Reporter: master | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* has_patch: 0 => 1
* stage: Accepted => Ready for checkin


Comment:

[https://github.com/django/django/pull/6495 PR]

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

Django

unread,
Apr 23, 2016, 10:02:11 AM4/23/16
to django-...@googlegroups.com
#26427: AttributeError for a deleted setting under @override_settings, when an
Exception is raised
-------------------------------------+-------------------------------------
Reporter: master | Owner: nobody
Type: Bug | Status: closed

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

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

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


Comment:

In [changeset:"669c29c8f4986def15cc4ee38b27299d32d5009f" 669c29c]:
{{{
#!CommitTicketReference repository=""
revision="669c29c8f4986def15cc4ee38b27299d32d5009f"
Fixed #26427 -- Ensured deleted setting doesn't appear in dir(settings)
}}}

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

Reply all
Reply to author
Forward
0 new messages