(self, request)
| 32 | return SITE_CACHE[site_id] |
| 33 | |
| 34 | def _get_site_by_request(self, request): |
| 35 | host = request.get_host() |
| 36 | try: |
| 37 | # First attempt to look up the site by host with or without port. |
| 38 | if host not in SITE_CACHE: |
| 39 | SITE_CACHE[host] = self.get(domain__iexact=host) |
| 40 | return SITE_CACHE[host] |
| 41 | except Site.DoesNotExist: |
| 42 | # Fallback to looking up site after stripping port from the host. |
| 43 | domain, port = split_domain_port(host) |
| 44 | if domain not in SITE_CACHE: |
| 45 | SITE_CACHE[domain] = self.get(domain__iexact=domain) |
| 46 | return SITE_CACHE[domain] |
| 47 | |
| 48 | def get_current(self, request=None): |
| 49 | """ |
no test coverage detected