diff options
| author | Дилян Палаузов <dilyanpalauzov@users.noreply.github.com> | 2017-11-06 10:23:29 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-11-07 09:08:46 -0500 |
| commit | c69e4bc69166b2d752b437a651dfa91f8b53ecfd (patch) | |
| tree | 49cb2c1b54962eff1a02636062b213397003e7ed /django/db | |
| parent | 00b93c2b1ecdda978f067309c6feafda633a7264 (diff) | |
Fixed #28769 -- Replaced 'x if x else y' with 'x or y'.
Diffstat (limited to 'django/db')
| -rw-r--r-- | django/db/backends/base/introspection.py | 2 | ||||
| -rw-r--r-- | django/db/backends/sqlite3/creation.py | 4 | ||||
| -rw-r--r-- | django/db/models/sql/query.py | 2 |
3 files changed, 3 insertions, 5 deletions
diff --git a/django/db/backends/base/introspection.py b/django/db/backends/base/introspection.py index 27a3cb2b87..154ae22bf1 100644 --- a/django/db/backends/base/introspection.py +++ b/django/db/backends/base/introspection.py @@ -130,7 +130,7 @@ class BaseDatabaseIntrospection: # we don't need to reset the sequence. if f.remote_field.through is None: sequence = self.get_sequences(cursor, f.m2m_db_table()) - sequence_list.extend(sequence if sequence else [{'table': f.m2m_db_table(), 'column': None}]) + sequence_list.extend(sequence or [{'table': f.m2m_db_table(), 'column': None}]) return sequence_list def get_sequences(self, cursor, table_name, table_fields=()): diff --git a/django/db/backends/sqlite3/creation.py b/django/db/backends/sqlite3/creation.py index 3c6fb291fa..2c45f63c2b 100644 --- a/django/db/backends/sqlite3/creation.py +++ b/django/db/backends/sqlite3/creation.py @@ -12,9 +12,7 @@ class DatabaseCreation(BaseDatabaseCreation): return database_name == ':memory:' or 'mode=memory' in database_name def _get_test_db_name(self): - test_database_name = self.connection.settings_dict['TEST']['NAME'] - if not test_database_name: - test_database_name = ':memory:' + test_database_name = self.connection.settings_dict['TEST']['NAME'] or ':memory:' if test_database_name == ':memory:': return 'file:memorydb_%s?mode=memory&cache=shared' % self.connection.alias return test_database_name diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 372431c620..57da2fe68b 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -606,7 +606,7 @@ class Query: # Ordering uses the 'rhs' ordering, unless it has none, in which case # the current ordering is used. - self.order_by = rhs.order_by if rhs.order_by else self.order_by + self.order_by = rhs.order_by or self.order_by self.extra_order_by = rhs.extra_order_by or self.extra_order_by def deferred_to_data(self, target, callback): |
