MCPcopy
hub / github.com/django/django / RequestSite

Class RequestSite

django/contrib/sites/requests.py:1–20  ·  view source on GitHub ↗

A class that shares the primary interface of Site (i.e., it has ``domain`` and ``name`` attributes) but gets its data from an HttpRequest object rather than from a database. The save() and delete() methods raise NotImplementedError.

Source from the content-addressed store, hash-verified

1class RequestSite:
2 """
3 A class that shares the primary interface of Site (i.e., it has ``domain``
4 and ``name`` attributes) but gets its data from an HttpRequest object
5 rather than from a database.
6
7 The save() and delete() methods raise NotImplementedError.
8 """
9
10 def __init__(self, request):
11 self.domain = self.name = request.get_host()
12
13 def __str__(self):
14 return self.domain
15
16 def save(self, force_insert=False, force_update=False):
17 raise NotImplementedError("RequestSite cannot be saved.")
18
19 def delete(self):
20 raise NotImplementedError("RequestSite cannot be deleted.")

Callers 2

setUpMethod · 0.90
get_current_siteFunction · 0.85

Calls

no outgoing calls

Tested by 1

setUpMethod · 0.72