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:
Carl Meyer 2011-10-08 08:16:17 +00:00
parent 0f5d69155e
commit b6ad1afa68
3 changed files with 48 additions and 13 deletions

View file

@ -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::