mirror of https://github.com/django/django.git
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
This commit is contained in:
parent
f43b3f58fb
commit
4e25bc71b1
|
@ -37,6 +37,6 @@ def check_err(code):
|
||||||
return
|
return
|
||||||
elif code in OGRERR_DICT:
|
elif code in OGRERR_DICT:
|
||||||
e, msg = OGRERR_DICT[code]
|
e, msg = OGRERR_DICT[code]
|
||||||
raise e, msg
|
raise e(msg)
|
||||||
else:
|
else:
|
||||||
raise OGRException('Unknown error code: "%s"' % code)
|
raise OGRException('Unknown error code: "%s"' % code)
|
||||||
|
|
|
@ -380,9 +380,9 @@ class _OutputRedirectingPdb(pdb.Pdb):
|
||||||
# [XX] Normalize with respect to os.path.pardir?
|
# [XX] Normalize with respect to os.path.pardir?
|
||||||
def _module_relative_path(module, path):
|
def _module_relative_path(module, path):
|
||||||
if not inspect.ismodule(module):
|
if not inspect.ismodule(module):
|
||||||
raise TypeError, 'Expected a module: %r' % module
|
raise TypeError('Expected a module: %r' % module)
|
||||||
if path.startswith('/'):
|
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.
|
# Find the base directory for the path.
|
||||||
if hasattr(module, '__file__'):
|
if hasattr(module, '__file__'):
|
||||||
|
|
|
@ -479,7 +479,7 @@ class TestCase(unittest.TestCase):
|
||||||
excName = excClass.__name__
|
excName = excClass.__name__
|
||||||
else:
|
else:
|
||||||
excName = str(excClass)
|
excName = str(excClass)
|
||||||
raise self.failureException, "%s not raised" % excName
|
raise self.failureException("%s not raised" % excName)
|
||||||
|
|
||||||
def _getAssertEqualityFunc(self, first, second):
|
def _getAssertEqualityFunc(self, first, second):
|
||||||
"""Get a detailed comparison function for the types of the two args.
|
"""Get a detailed comparison function for the types of the two args.
|
||||||
|
|
|
@ -252,7 +252,7 @@ class BasePersonModelFormSet(BaseModelFormSet):
|
||||||
person = person_dict.get('id')
|
person = person_dict.get('id')
|
||||||
alive = person_dict.get('alive')
|
alive = person_dict.get('alive')
|
||||||
if person and alive and person.name == "Grace Hopper":
|
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):
|
class PersonAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'gender', 'alive')
|
list_display = ('name', 'gender', 'alive')
|
||||||
|
|
|
@ -33,7 +33,7 @@ class BaseQuerysetTest(TestCase):
|
||||||
excName = exc.__name__
|
excName = exc.__name__
|
||||||
else:
|
else:
|
||||||
excName = str(exc)
|
excName = str(exc)
|
||||||
raise AssertionError, "%s not raised" % excName
|
raise AssertionError("%s not raised" % excName)
|
||||||
|
|
||||||
|
|
||||||
class Queries1Tests(BaseQuerysetTest):
|
class Queries1Tests(BaseQuerysetTest):
|
||||||
|
|
|
@ -389,7 +389,7 @@ class Templates(unittest.TestCase):
|
||||||
try:
|
try:
|
||||||
return (template_tests[template_name][0] , "test:%s" % template_name)
|
return (template_tests[template_name][0] , "test:%s" % template_name)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise template.TemplateDoesNotExist, template_name
|
raise template.TemplateDoesNotExist(template_name)
|
||||||
|
|
||||||
cache_loader = cached.Loader(('test_template_loader',))
|
cache_loader = cached.Loader(('test_template_loader',))
|
||||||
cache_loader._cached_loaders = (test_template_loader,)
|
cache_loader._cached_loaders = (test_template_loader,)
|
||||||
|
|
Loading…
Reference in New Issue