django1/django/views/rss/rss.py

13 lines
392 B
Python

from django.core import rss
from django.core.exceptions import Http404
from django.utils.httpwrappers import HttpResponse
def feed(request, slug, param=None):
try:
f = rss.get_registered_feed(slug).get_feed(param)
except rss.FeedIsNotRegistered:
raise Http404
response = HttpResponse(mimetype='application/xml')
f.write(response, 'utf-8')
return response