Changed re-raising an exception to use bare raise syntax where appropriate.

This commit is contained in:
Jon Dufresne 2020-01-19 14:13:58 -08:00 committed by Mariusz Felisiak
parent b64b1b2e1a
commit 26be703fe6
4 changed files with 5 additions and 5 deletions

View File

@ -26,7 +26,7 @@ class DatabaseCreation(BaseDatabaseCreation):
self.log('Got an error creating the test database: %s' % e) self.log('Got an error creating the test database: %s' % e)
sys.exit(2) sys.exit(2)
else: else:
raise e raise
def _clone_test_db(self, suffix, verbosity, keepdb=False): def _clone_test_db(self, suffix, verbosity, keepdb=False):
source_database_name = self.connection.settings_dict['NAME'] source_database_name = self.connection.settings_dict['NAME']

View File

@ -48,7 +48,7 @@ class DatabaseCreation(BaseDatabaseCreation):
elif not keepdb: elif not keepdb:
# If the database should be kept, ignore "database already # If the database should be kept, ignore "database already
# exists". # exists".
raise e raise
def _clone_test_db(self, suffix, verbosity, keepdb=False): def _clone_test_db(self, suffix, verbosity, keepdb=False):
# CREATE DATABASE ... WITH TEMPLATE ... requires closing connections # CREATE DATABASE ... WITH TEMPLATE ... requires closing connections

View File

@ -269,7 +269,7 @@ class MigrationLoader:
), ),
exc.node exc.node
) from exc ) from exc
raise exc raise
self.graph.ensure_not_cyclic() self.graph.ensure_not_cyclic()
def check_consistent_history(self, connection): def check_consistent_history(self, connection):

View File

@ -607,13 +607,13 @@ class QuerySet:
params = dict(resolve_callables(params)) params = dict(resolve_callables(params))
obj = self.create(**params) obj = self.create(**params)
return obj, True return obj, True
except IntegrityError as e: except IntegrityError:
try: try:
qs = self.select_for_update() if lock else self qs = self.select_for_update() if lock else self
return qs.get(**lookup), False return qs.get(**lookup), False
except self.model.DoesNotExist: except self.model.DoesNotExist:
pass pass
raise e raise
def _extract_model_params(self, defaults, **kwargs): def _extract_model_params(self, defaults, **kwargs):
""" """