mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #17011 - Made override_settings modify a decorated class in-place rather than creating a dynamic subclass, so as to avoid infinite recursion when used with super(). Thanks jsdalton for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16942 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
0f5d69155e
commit
b6ad1afa68
3 changed files with 48 additions and 13 deletions
|
@ -1450,6 +1450,15 @@ The decorator can also be applied to test case classes::
|
|||
|
||||
LoginTestCase = override_settings(LOGIN_URL='/other/login/')(LoginTestCase)
|
||||
|
||||
.. note::
|
||||
|
||||
When given a class, the decorator modifies the class directly and
|
||||
returns it; it doesn't create and return a modified copy of it. So if
|
||||
you try to tweak the above example to assign the return value to a
|
||||
different name than ``LoginTestCase``, you may be surprised to find that
|
||||
the original ``LoginTestCase`` is still equally affected by the
|
||||
decorator.
|
||||
|
||||
On Python 2.6 and higher you can also use the well known decorator syntax to
|
||||
decorate the class::
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue