You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

requests.py 640B

5 years ago
12345678910111213141516171819
  1. class 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. The save() and delete() methods raise NotImplementedError.
  7. """
  8. def __init__(self, request):
  9. self.domain = self.name = request.get_host()
  10. def __str__(self):
  11. return self.domain
  12. def save(self, force_insert=False, force_update=False):
  13. raise NotImplementedError('RequestSite cannot be saved.')
  14. def delete(self):
  15. raise NotImplementedError('RequestSite cannot be deleted.')