Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 4e25bc71b18e609768c4cf99854f350a5bc8e44d 1 parent f43b3f5
Adrian Holovaty authored March 14, 2011
2  django/contrib/gis/gdal/error.py
@@ -37,6 +37,6 @@ def check_err(code):
37 37
         return
38 38
     elif code in OGRERR_DICT:
39 39
         e, msg = OGRERR_DICT[code]
40  
-        raise e, msg
  40
+        raise e(msg)
41 41
     else:
42 42
         raise OGRException('Unknown error code: "%s"' % code)
4  django/test/_doctest.py
@@ -380,9 +380,9 @@ def trace_dispatch(self, *args):
380 380
 # [XX] Normalize with respect to os.path.pardir?
381 381
 def _module_relative_path(module, path):
382 382
     if not inspect.ismodule(module):
383  
-        raise TypeError, 'Expected a module: %r' % module
  383
+        raise TypeError('Expected a module: %r' % module)
384 384
     if path.startswith('/'):
385  
-        raise ValueError, 'Module-relative files may not have absolute paths'
  385
+        raise ValueError('Module-relative files may not have absolute paths')
386 386
 
387 387
     # Find the base directory for the path.
388 388
     if hasattr(module, '__file__'):
2  django/utils/unittest/case.py
@@ -479,7 +479,7 @@ def assertRaises(self, excClass, callableObj=None, *args, **kwargs):
479 479
             excName = excClass.__name__
480 480
         else:
481 481
             excName = str(excClass)
482  
-        raise self.failureException, "%s not raised" % excName
  482
+        raise self.failureException("%s not raised" % excName)
483 483
 
484 484
     def _getAssertEqualityFunc(self, first, second):
485 485
         """Get a detailed comparison function for the types of the two args.
2  tests/regressiontests/admin_views/models.py
@@ -252,7 +252,7 @@ def clean(self):
252 252
             person = person_dict.get('id')
253 253
             alive = person_dict.get('alive')
254 254
             if person and alive and person.name == "Grace Hopper":
255  
-                raise forms.ValidationError, "Grace is not a Zombie"
  255
+                raise forms.ValidationError("Grace is not a Zombie")
256 256
 
257 257
 class PersonAdmin(admin.ModelAdmin):
258 258
     list_display = ('name', 'gender', 'alive')
2  tests/regressiontests/queries/tests.py
@@ -33,7 +33,7 @@ def assertRaisesMessage(self, exc, msg, func, *args, **kwargs):
33 33
                 excName = exc.__name__
34 34
             else:
35 35
                 excName = str(exc)
36  
-            raise AssertionError, "%s not raised" % excName
  36
+            raise AssertionError("%s not raised" % excName)
37 37
 
38 38
 
39 39
 class Queries1Tests(BaseQuerysetTest):
2  tests/regressiontests/templates/tests.py
@@ -389,7 +389,7 @@ def test_template_loader(template_name, template_dirs=None):
389 389
             try:
390 390
                 return (template_tests[template_name][0] , "test:%s" % template_name)
391 391
             except KeyError:
392  
-                raise template.TemplateDoesNotExist, template_name
  392
+                raise template.TemplateDoesNotExist(template_name)
393 393
 
394 394
         cache_loader = cached.Loader(('test_template_loader',))
395 395
         cache_loader._cached_loaders = (test_template_loader,)

0 notes on commit 4e25bc7

Please sign in to comment.
Something went wrong with that request. Please try again.