diff options
| author | Mateo Radman <48420316+mateoradman@users.noreply.github.com> | 2021-07-02 19:33:48 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-07-05 13:31:03 +0200 |
| commit | 2231429991ee17987e3897238f9e5551c5c7ab2e (patch) | |
| tree | 923faeda02504ef6339ebaea705138af4cef3442 /django/db/backends/postgresql/creation.py | |
| parent | 1ff0ea6e9bd11788ca6f1ab09291f177934f589e (diff) | |
Refs #32508 -- Raised ImproperlyConfigured/TypeError instead of using "assert".
Diffstat (limited to 'django/db/backends/postgresql/creation.py')
| -rw-r--r-- | django/db/backends/postgresql/creation.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/django/db/backends/postgresql/creation.py b/django/db/backends/postgresql/creation.py index a609f33fd6..eb8ac3bcf5 100644 --- a/django/db/backends/postgresql/creation.py +++ b/django/db/backends/postgresql/creation.py @@ -2,6 +2,7 @@ import sys from psycopg2 import errorcodes +from django.core.exceptions import ImproperlyConfigured from django.db.backends.base.creation import BaseDatabaseCreation from django.db.backends.utils import strip_quotes @@ -21,9 +22,11 @@ class DatabaseCreation(BaseDatabaseCreation): def sql_table_creation_suffix(self): test_settings = self.connection.settings_dict['TEST'] - assert test_settings['COLLATION'] is None, ( - "PostgreSQL does not support collation setting at database creation time." - ) + if test_settings.get('COLLATION') is not None: + raise ImproperlyConfigured( + 'PostgreSQL does not support collation setting at database ' + 'creation time.' + ) return self._get_database_create_suffix( encoding=test_settings['CHARSET'], template=test_settings.get('TEMPLATE'), |
