Skip to content

Commit

Permalink
Remove deprecated SiteIDHook
Browse files Browse the repository at this point in the history
  • Loading branch information
Becky Smith committed Sep 4, 2018
1 parent 10366f8 commit 5ceea6d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
21 changes: 0 additions & 21 deletions multisite/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -478,14 +477,12 @@ def test_compare_site_ids(self):

def test_compare_differing_types(self):
self.site_id.set(1)
# SiteIDHook <op> 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 <op> SiteIDHook
self.assertNotEqual('1', self.site_id)
self.assertFalse('1' == self.site_id)
self.assertFalse('1' < self.site_id)
Expand Down Expand Up @@ -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):
Expand Down
7 changes: 0 additions & 7 deletions multisite/threadlocals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 5ceea6d

Please sign in to comment.