Code

Ticket #7039: patch_feed_lang.diff

File patch_feed_lang.diff, 1.4 KB (added by caa, 5 years ago)

Fixed patch format and added documentation

Line 
1Index: django/contrib/syndication/feeds.py
2===================================================================
3--- django/contrib/syndication/feeds.py (revision 9565)
4+++ django/contrib/syndication/feeds.py (working copy)
5@@ -104,7 +104,7 @@
6             subtitle = self.__get_dynamic_attr('subtitle', obj),
7             link = link,
8             description = self.__get_dynamic_attr('description', obj),
9-            language = settings.LANGUAGE_CODE.decode(),
10+            language = self.__get_dynamic_attr('language', obj) or settings.LANGUAGE_CODE.decode(),
11             feed_url = add_domain(current_site.domain,
12                                   self.__get_dynamic_attr('feed_url', obj)),
13             author_name = self.__get_dynamic_attr('author_name', obj),
14Index: docs/ref/contrib/syndication.txt
15===================================================================
16--- docs/ref/contrib/syndication.txt    (revision 9565)
17+++ docs/ref/contrib/syndication.txt    (working copy)
18@@ -332,7 +332,9 @@
19 
20 Feeds created by the syndication framework automatically include the
21 appropriate ``<language>`` tag (RSS 2.0) or ``xml:lang`` attribute (Atom). This
22-comes directly from your :setting:`LANGUAGE_CODE setting`.
23+comes directly from your :setting:`LANGUAGE_CODE setting` unless you define a
24+``language`` method/attribute in your :class:`~django.contrib.syndication.feeds.Feed`
25+class.
26 
27 URLs
28 ----