Django

Code

Show
Ignore:
Timestamp:
06/30/08 10:38:16 (6 months ago)
Author:
brosner
Message:

newforms-admin: Merged from trunk up to [7808]. Fixed #7519, #7573

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/newforms-admin

    • Property svnmerge-integrated changed from /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-7768 to /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-7808
  • django/branches/newforms-admin/django/test/testcases.py

    r7584 r7809  
    55from django.http import QueryDict 
    66from django.db import transaction 
     7from django.conf import settings 
    78from django.core import mail 
    89from django.core.management import call_command 
    910from django.test import _doctest as doctest 
    1011from django.test.client import Client 
     12from django.core.urlresolvers import clear_url_caches 
    1113 
    1214normalize_long_ints = lambda s: re.sub(r'(?<![\w])(\d+)L(?![\w])', '\\1', s) 
     
    5557            * If the Test Case class has a 'fixtures' member, installing the  
    5658              named fixtures. 
     59            * If the Test Case class has a 'urls' member, replace the 
     60              ROOT_URLCONF with it. 
    5761            * Clearing the mail test outbox. 
    5862        """ 
     
    6266            # that we're using *args and **kwargs together. 
    6367            call_command('loaddata', *self.fixtures, **{'verbosity': 0}) 
     68        if hasattr(self, 'urls'): 
     69            self._old_root_urlconf = settings.ROOT_URLCONF 
     70            settings.ROOT_URLCONF = self.urls 
     71            clear_url_caches() 
    6472        mail.outbox = [] 
    6573 
     
    8088            return 
    8189        super(TestCase, self).__call__(result) 
     90        try: 
     91            self._post_teardown() 
     92        except (KeyboardInterrupt, SystemExit): 
     93            raise 
     94        except Exception: 
     95            import sys 
     96            result.addError(self, sys.exc_info()) 
     97            return 
     98 
     99    def _post_teardown(self): 
     100        """ Performs any post-test things. This includes: 
     101 
     102            * Putting back the original ROOT_URLCONF if it was changed. 
     103        """ 
     104        if hasattr(self, '_old_root_urlconf'): 
     105            settings.ROOT_URLCONF = self._old_root_urlconf 
     106            clear_url_caches() 
    82107 
    83108    def assertRedirects(self, response, expected_url, status_code=302,