Python django.utils.feedgenerator.Rss201rev2Feed() Examples

The following are 8 code examples of django.utils.feedgenerator.Rss201rev2Feed(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.utils.feedgenerator , or try the search function .
Example #1
Source File: feeds.py    From django-radio with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, title, link, description, language=None, author_email=None,
                 author_name=None, author_link=None, subtitle=None, categories=None,
                 feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, **kwargs):
        self.programme = kwargs['programme']
        self.request = kwargs['request']
        feedgenerator.Rss201rev2Feed.__init__(
            self, title, link, description, self.programme.language.lower(), author_email, author_name,
            author_link, subtitle, categories, feed_url, feed_copyright, feed_guid, ttl
        ) 
Example #2
Source File: test_feedgenerator.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_rss_mime_type(self):
        """
        RSS MIME type has UTF8 Charset parameter set
        """
        rss_feed = feedgenerator.Rss201rev2Feed("title", "link", "description")
        self.assertEqual(
            rss_feed.content_type, "application/rss+xml; charset=utf-8"
        )

    # Two regression tests for #14202 
Example #3
Source File: test_feedgenerator.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_feed_without_feed_url_gets_rendered_without_atom_link(self):
        feed = feedgenerator.Rss201rev2Feed('title', '/link/', 'descr')
        self.assertIsNone(feed.feed['feed_url'])
        feed_content = feed.writeString('utf-8')
        self.assertNotIn('<atom:link', feed_content)
        self.assertNotIn('href="/feed/"', feed_content)
        self.assertNotIn('rel="self"', feed_content) 
Example #4
Source File: test_feedgenerator.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_feed_with_feed_url_gets_rendered_with_atom_link(self):
        feed = feedgenerator.Rss201rev2Feed('title', '/link/', 'descr', feed_url='/feed/')
        self.assertEqual(feed.feed['feed_url'], '/feed/')
        feed_content = feed.writeString('utf-8')
        self.assertIn('<atom:link', feed_content)
        self.assertIn('href="/feed/"', feed_content)
        self.assertIn('rel="self"', feed_content) 
Example #5
Source File: test_feedgenerator.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_latest_post_date_returns_utc_time(self):
        for use_tz in (True, False):
            with self.settings(USE_TZ=use_tz):
                rss_feed = feedgenerator.Rss201rev2Feed('title', 'link', 'description')
                self.assertEqual(rss_feed.latest_post_date().tzinfo, utc) 
Example #6
Source File: test_feedgenerator.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_rss_mime_type(self):
        """
        RSS MIME type has UTF8 Charset parameter set
        """
        rss_feed = feedgenerator.Rss201rev2Feed("title", "link", "description")
        self.assertEqual(
            rss_feed.content_type, "application/rss+xml; charset=utf-8"
        )

    # Two regression tests for #14202 
Example #7
Source File: test_feedgenerator.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_feed_with_feed_url_gets_rendered_with_atom_link(self):
        feed = feedgenerator.Rss201rev2Feed('title', '/link/', 'descr', feed_url='/feed/')
        self.assertEqual(feed.feed['feed_url'], '/feed/')
        feed_content = feed.writeString('utf-8')
        self.assertIn('<atom:link', feed_content)
        self.assertIn('href="/feed/"', feed_content)
        self.assertIn('rel="self"', feed_content) 
Example #8
Source File: test_feedgenerator.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_latest_post_date_returns_utc_time(self):
        for use_tz in (True, False):
            with self.settings(USE_TZ=use_tz):
                rss_feed = feedgenerator.Rss201rev2Feed('title', 'link', 'description')
                self.assertEqual(rss_feed.latest_post_date().tzinfo, utc)