Ticket #7936: syndication-lastmodified.2.diff
File syndication-lastmodified.2.diff, 1.1 KB (added by , 14 years ago) |
---|
-
django/contrib/syndication/views.py
7 7 from django.utils import feedgenerator, tzinfo 8 8 from django.utils.encoding import force_unicode, iri_to_uri, smart_unicode 9 9 from django.utils.html import escape 10 from django.utils.http import http_date 11 import time 10 12 11 13 def add_domain(domain, url): 12 14 if not (url.startswith('http://') … … 33 35 raise Http404('Feed object does not exist.') 34 36 feedgen = self.get_feed(obj, request) 35 37 response = HttpResponse(mimetype=feedgen.mime_type) 38 if getattr(self, "item_pubdate", False): 39 # if item_pubdate is defined by user, set header so 40 # ConditionalGetMiddleware is able to send 304 NOT MODIFIED 41 response['Last-Modified'] = http_date(time.mktime(feedgen.latest_post_date().timetuple())) 36 42 feedgen.write(response, 'utf-8') 37 43 return response 38 44