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.

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