1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

Fixed #18013 -- Use the new 'as' syntax for exceptions.

Thanks Clueless for the initial patch.
Note that unittest has been purposely left out (external package only used by Python 2.6).
This commit is contained in:
Claude Paroz
2012-04-28 18:09:37 +02:00
parent eefb00f301
commit 3904b74a3f
107 changed files with 306 additions and 354 deletions

View File

@@ -214,7 +214,7 @@ class BaseCommand(object):
from django.utils import translation
saved_lang = translation.get_language()
translation.activate('en-us')
except ImportError, e:
except ImportError as e:
# If settings should be available, but aren't,
# raise the error and quit.
if show_traceback:
@@ -240,7 +240,7 @@ class BaseCommand(object):
self.stdout.write(output)
if self.output_transaction:
self.stdout.write('\n' + self.style.SQL_KEYWORD("COMMIT;") + '\n')
except CommandError, e:
except CommandError as e:
if show_traceback:
traceback.print_exc()
else:
@@ -297,7 +297,7 @@ class AppCommand(BaseCommand):
raise CommandError('Enter at least one appname.')
try:
app_list = [models.get_app(app_label) for app_label in app_labels]
except (ImproperlyConfigured, ImportError), e:
except (ImproperlyConfigured, ImportError) as e:
raise CommandError("%s. Are you sure your INSTALLED_APPS setting is correct?" % e)
output = []
for app in app_list: