Code

Ticket #2912: pass_http_request.patch

File pass_http_request.patch, 1.4 KB (added by freyther@…, 8 years ago)

[patch] Safe the HttpRequest in Feed as self.request so it can be accessed by subclasses

  • django/contrib/syndication/feeds.py

    old new  
    1919    title_template = None 
    2020    description_template = None 
    2121 
    22     def __init__(self, slug, feed_url): 
     22    def __init__(self, slug, request): 
    2323        self.slug = slug 
    24         self.feed_url = feed_url 
     24        self.feed_url = request.path 
     25        self.request = request 
    2526        self.title_template_name = self.title_template or ('feeds/%s_title.html' % slug) 
    2627        self.description_template_name = self.description_template or ('feeds/%s_description.html' % slug) 
    2728 
  • django/contrib/syndication/views.py

    old new  
    1616        raise Http404, "Slug %r isn't registered." % slug 
    1717 
    1818    try: 
    19         feedgen = f(slug, request.path).get_feed(param) 
     19        feedgen = f(slug, request).get_feed(param) 
    2020    except feeds.FeedDoesNotExist: 
    2121        raise Http404, "Invalid feed parameters. Slug %r is valid, but other parameters, or lack thereof, are not." % slug 
    2222