| 1 |
from django.http import Http404 |
| 2 |
from django.utils.translation import gettext as _ |
| 3 |
|
| 4 |
|
| 5 |
def feed(request, url, feed_dict=None): |
| 6 |
"""Provided for backwards compatibility.""" |
| 7 |
if not feed_dict: |
| 8 |
raise Http404(_("No feeds are registered.")) |
| 9 |
|
| 10 |
slug = url.partition("/")[0] |
| 11 |
try: |
| 12 |
f = feed_dict[slug] |
| 13 |
except KeyError: |
| 14 |
raise Http404(_("Slug %r isn’t registered.") % slug) |
| 15 |
|
| 16 |
instance = f() |
| 17 |
instance.feed_url = getattr(f, "feed_url", None) or request.path |
| 18 |
instance.title_template = f.title_template or ("feeds/%s_title.html" % slug) |
| 19 |
instance.description_template = f.description_template or ( |
| 20 |
"feeds/%s_description.html" % slug |
| 21 |
) |
| 22 |
return instance(request) |