[datafeed] Set headers parameter to an empty dict in DataFeedParser.retrieve_url

This parameter is then passed to urllib2.Request, which expects a dict and won't check for None.

Closes #4842333.

authorDenis Laxalde <denis.laxalde@logilab.fr>
changeset2eb06486273a
branchdefault
phasepublic
hiddenno
parent revision#f4a4556f23da [views/forms] Fix EntityFieldsForm.link_to when parent entity is being created
child revision#5bdaef93665f [pkg] include missing files from doc/book/ in release tarballs
files modified by this revision
server/sources/datafeed.py
# HG changeset patch
# User Denis Laxalde <denis.laxalde@logilab.fr>
# Date 1420644147 -3600
# Wed Jan 07 16:22:27 2015 +0100
# Node ID 2eb06486273a2bedc3dd9c7b43829910178cf8ad
# Parent f4a4556f23da8034d66d718466b3d18b625611a9
[datafeed] Set headers parameter to an empty dict in DataFeedParser.retrieve_url

This parameter is then passed to urllib2.Request, which expects a dict and
won't check for None.

Closes #4842333.

diff --git a/server/sources/datafeed.py b/server/sources/datafeed.py
@@ -317,10 +317,12 @@
1          """Return stream linked by the given url:
2          * HTTP urls will be normalized (see :meth:`normalize_url`)
3          * handle file:// URL
4          * other will be considered as plain content, useful for testing purpose
5          """
6 +        if headers is None:
7 +            headers = {}
8          if url.startswith('http'):
9              url = self.normalize_url(url)
10              if data:
11                  self.source.info('POST %s %s', url, data)
12              else: