diff options
| author | Simon Charette <charettes@users.noreply.github.com> | 2017-10-06 12:47:08 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-10-06 12:47:08 -0400 |
| commit | 9d93dff33338c90a55f7158fbbe0d82e88e13fa3 (patch) | |
| tree | e82f2500e84877ddf0aa303a0756cf01cf8e6a1f /django/db | |
| parent | 7d8d630e37209eba672d5382cc2effe192ab2510 (diff) | |
Fixed #28665 -- Change some database exceptions to NotImplementedError per PEP 249.
Diffstat (limited to 'django/db')
| -rw-r--r-- | django/db/backends/base/features.py | 6 | ||||
| -rw-r--r-- | django/db/backends/base/operations.py | 2 | ||||
| -rw-r--r-- | django/db/backends/sqlite3/operations.py | 2 | ||||
| -rw-r--r-- | django/db/models/lookups.py | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py index 3a89cc0900..3706e12db1 100644 --- a/django/db/backends/base/features.py +++ b/django/db/backends/base/features.py @@ -1,5 +1,5 @@ from django.db.models.aggregates import StdDev -from django.db.utils import ProgrammingError +from django.db.utils import NotSupportedError, ProgrammingError from django.utils.functional import cached_property @@ -269,9 +269,9 @@ class BaseDatabaseFeatures: """Confirm support for STDDEV and related stats functions.""" try: self.connection.ops.check_expression_support(StdDev(1)) - return True - except NotImplementedError: + except NotSupportedError: return False + return True def introspected_boolean_field_type(self, field=None): """ diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py index 3517300b50..3d476b77da 100644 --- a/django/db/backends/base/operations.py +++ b/django/db/backends/base/operations.py @@ -579,7 +579,7 @@ class BaseDatabaseOperations: This is used on specific backends to rule out known expressions that have problematic or nonexistent implementations. If the expression has a known problem, the backend should raise - NotImplementedError. + NotSupportedError. """ pass diff --git a/django/db/backends/sqlite3/operations.py b/django/db/backends/sqlite3/operations.py index 408848c9ad..e90cc052d0 100644 --- a/django/db/backends/sqlite3/operations.py +++ b/django/db/backends/sqlite3/operations.py @@ -43,7 +43,7 @@ class DatabaseOperations(BaseDatabaseOperations): pass else: if isinstance(output_field, bad_fields): - raise NotImplementedError( + raise utils.NotSupportedError( 'You cannot use Sum, Avg, StdDev, and Variance ' 'aggregations on date/time fields in sqlite3 ' 'since date/time is saved as text.' diff --git a/django/db/models/lookups.py b/django/db/models/lookups.py index f79f435515..66945c4a1a 100644 --- a/django/db/models/lookups.py +++ b/django/db/models/lookups.py @@ -25,7 +25,7 @@ class Lookup: # a bilateral transformation on a nested QuerySet: that won't work. from django.db.models.sql.query import Query # avoid circular import if isinstance(rhs, Query): - raise NotImplementedError("Bilateral transformations on nested querysets are not supported.") + raise NotImplementedError("Bilateral transformations on nested querysets are not implemented.") self.bilateral_transforms = bilateral_transforms def apply_bilateral_transforms(self, value): |
