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.
 
 
 
 

23 lines
740 B

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