Ticket #13896: django_13896_20110506.diff
File django_13896_20110506.diff, 3.6 KB (added by , 14 years ago) |
---|
-
docs/ref/contrib/syndication.txt
268 268 -------- 269 269 270 270 Feeds 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. 271 appropriate ``<language>`` tag (RSS 2.0) or ``xml:lang`` attribute (Atom). You 272 can set the language for a feed by specifying an attribute :attr:`language`, 273 using the same format as the project-wide setting :setting:`LANGUAGE_CODE`. If 274 you don't specify a language, it comes directly from your 275 :setting:`LANGUAGE_CODE` setting. 273 276 274 277 URLs 275 278 ---- -
django/contrib/syndication/views.py
104 104 subtitle = self.__get_dynamic_attr('subtitle', obj), 105 105 link = link, 106 106 description = self.__get_dynamic_attr('description', obj), 107 language = se ttings.LANGUAGE_CODE.decode(),107 language = self.__get_dynamic_attr('language', obj, settings.LANGUAGE_CODE.decode()), 108 108 feed_url = add_domain( 109 109 current_site.domain, 110 110 self.__get_dynamic_attr('feed_url', obj) or request.path, -
tests/regressiontests/syndication/tests.py
7 7 from django.test import TestCase 8 8 from django.utils import tzinfo 9 9 from django.utils.feedgenerator import rfc2822_date, rfc3339_date 10 from django.conf import settings 10 11 11 12 from models import Entry 12 13 … … 226 227 updated = doc.getElementsByTagName('updated')[0].firstChild.wholeText 227 228 self.assertEqual(updated[-6:], '+00:42') 228 229 230 def test_language_code(self): 231 """ 232 Test that language code is set via dynamic parameter. 233 """ 234 response = self.client.get('/syndication/language/') 235 feed = minidom.parseString(response.content).firstChild 236 self.assertEqual(feed.getElementsByTagName('language')[0].firstChild.wholeText, 'tl') 237 #Make sure that it's not because Tagalog is set in settings already 238 self.assertNotEqual(settings.LANGUAGE_CODE.decode(), 'tl') 239 229 240 def test_feed_url(self): 230 241 """ 231 242 Test that the feed_url can be overridden. -
tests/regressiontests/syndication/urls.py
13 13 (r'^syndication/feedurl/$', feeds.TestFeedUrlFeed()), 14 14 (r'^syndication/articles/$', feeds.ArticlesFeed()), 15 15 (r'^syndication/template/$', feeds.TemplateFeed()), 16 (r'^syndication/language/$', feeds.LanguageFeed()), 16 17 ) -
tests/regressiontests/syndication/feeds.py
91 91 # settings.TIME_ZONE. 92 92 return item.date.replace(tzinfo=tzinfo.FixedOffset(42)) 93 93 94 class LanguageFeed(TestRss2Feed): 95 language = 'tl' 94 96 95 97 class TestFeedUrlFeed(TestAtomFeed): 96 98 feed_url = 'http://example.com/customfeedurl/'