MCPcopy
hub / github.com/django/django / __call__

Method __call__

django/contrib/syndication/views.py:35–49  ·  view source on GitHub ↗
(self, request, *args, **kwargs)

Source from the content-addressed store, hash-verified

33 language = None
34
35 def __call__(self, request, *args, **kwargs):
36 try:
37 obj = self.get_object(request, *args, **kwargs)
38 except ObjectDoesNotExist:
39 raise Http404("Feed object does not exist.")
40 feedgen = self.get_feed(obj, request)
41 response = HttpResponse(content_type=feedgen.content_type)
42 if hasattr(self, "item_pubdate") or hasattr(self, "item_updateddate"):
43 # if item_pubdate or item_updateddate is defined for the feed, set
44 # header so as ConditionalGetMiddleware can send 304 NOT MODIFIED.
45 response.headers["Last-Modified"] = http_date(
46 feedgen.latest_post_date().timestamp()
47 )
48 feedgen.write(response, "utf-8")
49 return response
50
51 def item_title(self, item):
52 # Titles should be double escaped by default (see #6533)

Callers

nothing calls this directly

Calls 8

get_objectMethod · 0.95
get_feedMethod · 0.95
Http404Class · 0.90
HttpResponseClass · 0.90
http_dateFunction · 0.90
timestampMethod · 0.80
latest_post_dateMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected