#NEWLINE# def feed( request , url , feed_dict = None ) : #NEWLINE# #INDENT# 'Provided for backwards compatibility.' #NEWLINE# from django.contrib.syndication.feeds import Feed as LegacyFeed #NEWLINE# import warnings #NEWLINE# warnings . warn ( 'The syndication feed() view is deprecated. Please use the new class based view API.' , category = PendingDeprecationWarning ) #NEWLINE# if ( not feed_dict ) : #NEWLINE# #INDENT# raise Http404 ( 'No feeds are registered.' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# ( slug , param ) = url . split ( '/' , 1 ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# ( slug , param ) = ( url , '' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# f = feed_dict [ slug ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# raise Http404 ( ( "Slug %r isn't registered." % slug ) ) #NEWLINE# #UNINDENT# if ( not issubclass ( f , LegacyFeed ) ) : #NEWLINE# #INDENT# instance = f ( ) #NEWLINE# instance . feed_url = ( getattr ( f , 'feed_url' , None ) or request . path ) #NEWLINE# instance . title_template = ( f . title_template or ( 'feeds/%s_title.html' % slug ) ) #NEWLINE# instance . description_template = ( f . description_template or ( 'feeds/%s_description.html' % slug ) ) #NEWLINE# return instance ( request ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# feedgen = f ( slug , request ) . get_feed ( param ) #NEWLINE# #UNINDENT# except FeedDoesNotExist : #NEWLINE# #INDENT# raise Http404 ( ( 'Invalid feed parameters. Slug %r is valid, but other parameters, or lack thereof, are not.' % slug ) ) #NEWLINE# #UNINDENT# response = HttpResponse ( mimetype = feedgen . mime_type ) #NEWLINE# feedgen . write ( response , 'utf-8' ) #NEWLINE# return instance