Ticket #13896: django_13896_2.diff

File django_13896_2.diff, 3.7 KB (added by Jason Kotenko, 14 years ago)

SVN Diff

  • docs/ref/contrib/syndication.txt

     
    268268--------
    269269
    270270Feeds created by the syndication framework automatically include the
    271 appropriate ``<language>`` tag (RSS 2.0) or ``xml:lang`` attribute (Atom). This
    272 comes directly from your :setting:`LANGUAGE_CODE` setting.
     271appropriate ``<language>`` tag (RSS 2.0) or ``xml:lang`` attribute (Atom). You
     272can set the language for a feed by specifying an attribute :attr:`language`,
     273using the same format as the project-wide setting :setting:`LANGUAGE_CODE`. If
     274you don't specify a language, it comes directly from your
     275:setting:`LANGUAGE_CODE` setting.
    273276
    274277URLs
    275278----
  • django/contrib/syndication/views.py

     
    104104            subtitle = self.__get_dynamic_attr('subtitle', obj),
    105105            link = link,
    106106            description = self.__get_dynamic_attr('description', obj),
    107             language = settings.LANGUAGE_CODE.decode(),
     107            language = self.__get_dynamic_attr('language', obj, settings.LANGUAGE_CODE.decode()),
    108108            feed_url = add_domain(
    109109                current_site.domain,
    110110                self.__get_dynamic_attr('feed_url', obj) or request.path,
  • tests/regressiontests/syndication/tests.py

     
    77from django.test import TestCase
    88from django.utils import tzinfo
    99from django.utils.feedgenerator import rfc2822_date, rfc3339_date
     10from django.conf import settings
    1011
    1112from models import Entry
    1213
     
    224225        doc = minidom.parseString(response.content)
    225226        updated = doc.getElementsByTagName('updated')[0].firstChild.wholeText
    226227        self.assertEqual(updated[-6:], '+00:42')
     228   
     229    def test_language_code(self):
     230        """
     231        Test that language code is set via dynamic parameter.
     232        """
     233        response = self.client.get('/syndication/language/')
     234        feed = minidom.parseString(response.content).firstChild
     235        self.assertEqual(feed.getElementsByTagName('language')[0].firstChild.wholeText, 'tl')
     236        #Make sure that it's not because Tagalog is set in settings already
     237        self.assertNotEqual(settings.LANGUAGE_CODE.decode(), 'tl')
    227238
    228239    def test_feed_url(self):
    229240        """
  • tests/regressiontests/syndication/urls.py

     
    1818    (r'^feedurl/$', feeds.TestFeedUrlFeed()),
    1919    (r'^articles/$', feeds.ArticlesFeed()),
    2020    (r'^template/$', feeds.TemplateFeed()),
     21    (r'^language/$', feeds.LanguageFeed()),
    2122
    2223    (r'^depr-feeds/(?P<url>.*)/$', 'feed', {'feed_dict': feed_dict}),
    2324    (r'^depr-feeds-empty/(?P<url>.*)/$', 'feed', {'feed_dict': None}),
  • tests/regressiontests/syndication/feeds.py

     
    9191        # settings.TIME_ZONE.
    9292        return item.date.replace(tzinfo=tzinfo.FixedOffset(42))
    9393
     94class LanguageFeed(TestRss2Feed):
     95    language = 'tl'
    9496
    9597class TestFeedUrlFeed(TestAtomFeed):
    9698    feed_url = 'http://example.com/customfeedurl/'
Back to Top