From 4e25bc71b18e609768c4cf99854f350a5bc8e44d Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Mon, 14 Mar 2011 23:00:03 +0000 Subject: [PATCH] Fixed #15609 -- Fixed some 'raise' statements to use the newer style syntax. Thanks, DaNmarner git-svn-id: http://code.djangoproject.com/svn/django/trunk@15811 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/gis/gdal/error.py | 2 +- django/test/_doctest.py | 4 ++-- django/utils/unittest/case.py | 2 +- tests/regressiontests/admin_views/models.py | 2 +- tests/regressiontests/queries/tests.py | 2 +- tests/regressiontests/templates/tests.py | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/django/contrib/gis/gdal/error.py b/django/contrib/gis/gdal/error.py index 58ca891672..1d89ad1a42 100644 --- a/django/contrib/gis/gdal/error.py +++ b/django/contrib/gis/gdal/error.py @@ -37,6 +37,6 @@ def check_err(code): return elif code in OGRERR_DICT: e, msg = OGRERR_DICT[code] - raise e, msg + raise e(msg) else: raise OGRException('Unknown error code: "%s"' % code) diff --git a/django/test/_doctest.py b/django/test/_doctest.py index 17fc88a1bc..485e33c0ab 100644 --- a/django/test/_doctest.py +++ b/django/test/_doctest.py @@ -380,9 +380,9 @@ class _OutputRedirectingPdb(pdb.Pdb): # [XX] Normalize with respect to os.path.pardir? def _module_relative_path(module, path): if not inspect.ismodule(module): - raise TypeError, 'Expected a module: %r' % module + raise TypeError('Expected a module: %r' % module) if path.startswith('/'): - raise ValueError, 'Module-relative files may not have absolute paths' + raise ValueError('Module-relative files may not have absolute paths') # Find the base directory for the path. if hasattr(module, '__file__'): diff --git a/django/utils/unittest/case.py b/django/utils/unittest/case.py index 5ae602957b..8d943e2ce0 100644 --- a/django/utils/unittest/case.py +++ b/django/utils/unittest/case.py @@ -479,7 +479,7 @@ class TestCase(unittest.TestCase): excName = excClass.__name__ else: excName = str(excClass) - raise self.failureException, "%s not raised" % excName + raise self.failureException("%s not raised" % excName) def _getAssertEqualityFunc(self, first, second): """Get a detailed comparison function for the types of the two args. diff --git a/tests/regressiontests/admin_views/models.py b/tests/regressiontests/admin_views/models.py index 220b4a3575..b65f8a4b37 100644 --- a/tests/regressiontests/admin_views/models.py +++ b/tests/regressiontests/admin_views/models.py @@ -252,7 +252,7 @@ class BasePersonModelFormSet(BaseModelFormSet): person = person_dict.get('id') alive = person_dict.get('alive') if person and alive and person.name == "Grace Hopper": - raise forms.ValidationError, "Grace is not a Zombie" + raise forms.ValidationError("Grace is not a Zombie") class PersonAdmin(admin.ModelAdmin): list_display = ('name', 'gender', 'alive') diff --git a/tests/regressiontests/queries/tests.py b/tests/regressiontests/queries/tests.py index c13ca2c4b4..c87ecd32df 100644 --- a/tests/regressiontests/queries/tests.py +++ b/tests/regressiontests/queries/tests.py @@ -33,7 +33,7 @@ class BaseQuerysetTest(TestCase): excName = exc.__name__ else: excName = str(exc) - raise AssertionError, "%s not raised" % excName + raise AssertionError("%s not raised" % excName) class Queries1Tests(BaseQuerysetTest): diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py index cb831348ce..10c7a37258 100644 --- a/tests/regressiontests/templates/tests.py +++ b/tests/regressiontests/templates/tests.py @@ -389,7 +389,7 @@ class Templates(unittest.TestCase): try: return (template_tests[template_name][0] , "test:%s" % template_name) except KeyError: - raise template.TemplateDoesNotExist, template_name + raise template.TemplateDoesNotExist(template_name) cache_loader = cached.Loader(('test_template_loader',)) cache_loader._cached_loaders = (test_template_loader,)