diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-04-09 22:41:33 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-04-09 22:41:33 +0200 |
| commit | 5f2f47fdfcc063a60ad1c3688e0c6d44b066d549 (patch) | |
| tree | f997c10ccc21537bc198294ea67004b96637d5bf /django/db/backends/__init__.py | |
| parent | 2791fbf59d85a20adac22ed73c88a97fc0350426 (diff) | |
Fixed #21553 -- Ensured unusable database connections get closed.
Diffstat (limited to 'django/db/backends/__init__.py')
| -rw-r--r-- | django/db/backends/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index a8e0cc526c..4a03ccb658 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -351,9 +351,14 @@ class BaseDatabaseWrapper(object): def is_usable(self): """ Tests if the database connection is usable. + This function may assume that self.connection is not None. + + Actual implementations should take care not to raise exceptions + as that may prevent Django from recycling unusable connections. """ - raise NotImplementedError('subclasses of BaseDatabaseWrapper may require an is_usable() method') + raise NotImplementedError( + "subclasses of BaseDatabaseWrapper may require an is_usable() method") def close_if_unusable_or_obsolete(self): """ |
