diff options
| author | Pavlo Kapyshin <PavloKapyshin@users.noreply.github.com> | 2017-02-24 16:46:31 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-02-24 09:46:31 -0500 |
| commit | b6fbf3e8e56b34fdc4367d582bbcb036e4aa2972 (patch) | |
| tree | e8f9d952f29d683ab40eb44801cb5e3fb9b352bb | |
| parent | 508b5debfb16843a8443ebac82c1fb91f15da687 (diff) | |
Fixed #27879 -- Fixed crash if enclosures aren't provided to Atom1Feed.add_item().
Regression in 75cf9b5ac031feb8f94271c9906157c921a14520
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | django/utils/feedgenerator.py | 2 | ||||
| -rw-r--r-- | tests/utils_tests/test_feedgenerator.py | 6 |
3 files changed, 8 insertions, 1 deletions
@@ -612,6 +612,7 @@ answer newbie questions, and generally made Django that much better: Paulo Scardine <paulo@scardine.com.br> Paul Smith <blinkylights23@gmail.com> pavithran s <pavithran.s@gmail.com> + Pavlo Kapyshin <i@93z.org> permonik@mesias.brnonet.cz Petar Marić <http://www.petarmaric.com/> Pete Crosier <pete.crosier@gmail.com> diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py index 9dec126941..fa5c1f03ba 100644 --- a/django/utils/feedgenerator.py +++ b/django/utils/feedgenerator.py @@ -137,7 +137,7 @@ class SyndicationFeed: 'comments': to_str(comments), 'unique_id': to_str(unique_id), 'unique_id_is_permalink': unique_id_is_permalink, - 'enclosures': enclosures, + 'enclosures': enclosures or (), 'categories': categories or (), 'item_copyright': to_str(item_copyright), 'ttl': ttl, diff --git a/tests/utils_tests/test_feedgenerator.py b/tests/utils_tests/test_feedgenerator.py index 8c0edb4374..78e4d5b737 100644 --- a/tests/utils_tests/test_feedgenerator.py +++ b/tests/utils_tests/test_feedgenerator.py @@ -120,6 +120,12 @@ class FeedgeneratorTest(unittest.TestCase): self.assertIn('href="/feed/"', feed_content) self.assertIn('rel="self"', feed_content) + def test_atom_add_item(self): + # Not providing any optional arguments to Atom1Feed.add_item() + feed = feedgenerator.Atom1Feed('title', '/link/', 'descr') + feed.add_item('item_title', 'item_link', 'item_description') + feed.writeString('utf-8') + class FeedgeneratorDBTest(TestCase): |
