From 5ceea6dfa4f01ed667b4d016c9dff93205d02835 Mon Sep 17 00:00:00 2001 From: Becky Smith Date: Tue, 4 Sep 2018 09:51:43 +0100 Subject: [PATCH] Remove deprecated SiteIDHook --- multisite/tests.py | 21 --------------------- multisite/threadlocals.py | 7 ------- 2 files changed, 28 deletions(-) diff --git a/multisite/tests.py b/multisite/tests.py index fae5b30..8f0e8bf 100644 --- a/multisite/tests.py +++ b/multisite/tests.py @@ -44,7 +44,6 @@ from .hosts import ALLOWED_HOSTS, AllowedHosts, IterableLazyObject from .middleware import CookieDomainMiddleware, DynamicSiteMiddleware from .models import Alias -from .threadlocals import SiteIDHook class RequestFactory(DjangoRequestFactory): @@ -478,14 +477,12 @@ def test_compare_site_ids(self): def test_compare_differing_types(self): self.site_id.set(1) - # SiteIDHook int self.assertNotEqual(self.site_id, '1') self.assertFalse(self.site_id == '1') self.assertTrue(self.site_id < '1') self.assertTrue(self.site_id <= '1') self.assertFalse(self.site_id > '1') self.assertFalse(self.site_id >= '1') - # int SiteIDHook self.assertNotEqual('1', self.site_id) self.assertFalse('1' == self.site_id) self.assertFalse('1' < self.site_id) @@ -547,24 +544,6 @@ def test_deferred_site(self): site.id) -@pytest.mark.django_db -class TestSiteIDHook(TestCase): - def test_deprecation_warning(self): - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('always') - threadlocals.__warningregistry__ = {} - SiteIDHook() - self.assertTrue(w) - self.assertTrue(issubclass(w[-1].category, DeprecationWarning)) - - def test_default_value(self): - with warnings.catch_warnings(): - warnings.simplefilter('ignore') - site_id = SiteIDHook() - self.assertEqual(site_id.default, 1) - self.assertEqual(int(site_id), 1) - - @pytest.mark.django_db class AliasTest(TestCase): def setUp(self): diff --git a/multisite/threadlocals.py b/multisite/threadlocals.py index 300dbe6..ec57c5f 100644 --- a/multisite/threadlocals.py +++ b/multisite/threadlocals.py @@ -154,10 +154,3 @@ def get_default(self): qset = Site.objects.only('id') self.default = qset.get(domain=self.default_domain).id return self.default - - -def SiteIDHook(): - """Deprecated: Use multisite.SiteID(default=1) for identical behaviour.""" - warn('Use multisite.SiteID instead of multisite.threadlocals.SiteIDHook', - DeprecationWarning, stacklevel=2) - return SiteID(default=1)