Ticket #13896: django_13896_2.diff
File django_13896_2.diff, 3.7 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 … … 224 225 doc = minidom.parseString(response.content) 225 226 updated = doc.getElementsByTagName('updated')[0].firstChild.wholeText 226 227 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') 227 238 228 239 def test_feed_url(self): 229 240 """ -
tests/regressiontests/syndication/urls.py
18 18 (r'^feedurl/$', feeds.TestFeedUrlFeed()), 19 19 (r'^articles/$', feeds.ArticlesFeed()), 20 20 (r'^template/$', feeds.TemplateFeed()), 21 (r'^language/$', feeds.LanguageFeed()), 21 22 22 23 (r'^depr-feeds/(?P<url>.*)/$', 'feed', {'feed_dict': feed_dict}), 23 24 (r'^depr-feeds-empty/(?P<url>.*)/$', 'feed', {'feed_dict': None}), -
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/'