Fixed #27879 -- Fixed crash if enclosures aren't provided to Atom1Feed.add_item().

Regression in 75cf9b5ac0
This commit is contained in:
Pavlo Kapyshin 2017-02-24 16:46:31 +02:00 committed by Tim Graham
parent 508b5debfb
commit b6fbf3e8e5
3 changed files with 8 additions and 1 deletions

View File

@ -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>

View File

@ -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,

View File

@ -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):