diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-06-07 15:10:56 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-06-07 17:04:10 +0200 |
| commit | 58de495c54c203dfa838538fb6ca46187120f4e6 (patch) | |
| tree | 0b63bb90c9ba96738c1b00009ecfc62351899208 | |
| parent | d98cc41a845237edd62013e3156a0991dfb3d93e (diff) | |
Fixed #17427 -- Removed dubious definition of connections equality.
| -rw-r--r-- | django/db/backends/__init__.py | 11 | ||||
| -rw-r--r-- | docs/releases/1.8.txt | 3 | ||||
| -rw-r--r-- | tests/db_backends/__init__.py | 0 | ||||
| -rw-r--r-- | tests/db_backends/tests.py | 36 |
4 files changed, 3 insertions, 47 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 587cd874d9..7c00773d42 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -73,17 +73,6 @@ class BaseDatabaseWrapper(object): self.allow_thread_sharing = allow_thread_sharing self._thread_ident = thread.get_ident() - def __eq__(self, other): - if isinstance(other, BaseDatabaseWrapper): - return self.alias == other.alias - return NotImplemented - - def __ne__(self, other): - return not self == other - - def __hash__(self): - return hash(self.alias) - @property def queries(self): if len(self.queries_log) == self.queries_log.maxlen: diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt index 50d27aceb8..ade8f9b7df 100644 --- a/docs/releases/1.8.txt +++ b/docs/releases/1.8.txt @@ -270,6 +270,9 @@ Miscellaneous * ``connections.queries`` is now a read-only attribute. +* Database connections are considered equal only if they're the same object. + They aren't hashable any more. + * ``URLField.to_python`` no longer adds a trailing slash to pathless URLs. * ``django.contrib.gis`` dropped support for GEOS 3.1 and GDAL 1.6. diff --git a/tests/db_backends/__init__.py b/tests/db_backends/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/db_backends/__init__.py +++ /dev/null diff --git a/tests/db_backends/tests.py b/tests/db_backends/tests.py deleted file mode 100644 index 052ee87254..0000000000 --- a/tests/db_backends/tests.py +++ /dev/null @@ -1,36 +0,0 @@ -from django.test import TestCase -from django.db.backends import BaseDatabaseWrapper - - -class DummyDatabaseWrapper(BaseDatabaseWrapper): - pass - - -class DummyObject(object): - alias = None - - -class DbBackendTests(TestCase): - def test_compare_db_wrapper_with_another_object(self): - wrapper = BaseDatabaseWrapper({}) - self.assertFalse(wrapper == 'not-a-db-wrapper') - - def test_compare_db_wrapper_with_another_object_with_alias(self): - wrapper = BaseDatabaseWrapper({}) - obj = DummyObject() - obj.alias = wrapper.alias = 'foobar' - self.assertFalse(wrapper == obj) - - def test_negate_compare_db_wrapper_with_another_object(self): - wrapper = BaseDatabaseWrapper({}) - self.assertTrue(wrapper != 'not-a-db-wrapper') - - def test_compare_db_wrappers(self): - wrapper1 = DummyDatabaseWrapper({}) - wrapper2 = BaseDatabaseWrapper({}) - - wrapper1.alias = wrapper2.alias = 'foo' - self.assertTrue(wrapper1 == wrapper2) - - wrapper1.alias = 'bar' - self.assertFalse(wrapper1 == wrapper2) |
