Commit a2bad26c authored by fred's avatar fred

feed: include xml:base attribute for proper (image) relative link resolution

parent 0a79868b
......@@ -4,6 +4,7 @@ import random
import os
import stat
import time
import urlparse
from django.core.urlresolvers import reverse
from django.conf import settings
......@@ -698,8 +699,15 @@ class RssNewsFeed(Feed):
rss_news_feed = RssNewsFeed()
class Atom1FeedWithBaseXml(Atom1Feed):
def root_attributes(self):
root_attributes = super(Atom1FeedWithBaseXml, self).root_attributes()
scheme, netloc, path, params, query, fragment = urlparse.urlparse(self.feed['feed_url'])
root_attributes['xml:base'] = urlparse.urlunparse((scheme, netloc, '/', params, query, fragment))
return root_attributes
class AtomNewsFeed(RssNewsFeed):
feed_type = Atom1Feed
feed_type = Atom1FeedWithBaseXml
atom_news_feed = AtomNewsFeed()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment