clarify newdata in update
This commit is contained in:
parent
3539e50c9d
commit
f6a85c119b
@ -122,8 +122,8 @@ class Connection(object):
|
|||||||
# update strategies could be implemented here as well
|
# update strategies could be implemented here as well
|
||||||
try:
|
try:
|
||||||
url = doc['url'].replace(' ', '%20')
|
url = doc['url'].replace(' ', '%20')
|
||||||
data = self.scraper.urlopen(url)
|
newdata = self.scraper.urlopen(url)
|
||||||
content_type = data.response.headers['content-type']
|
content_type = newdata.response.headers['content-type']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
do_put = False
|
do_put = False
|
||||||
error = str(e)
|
error = str(e)
|
||||||
@ -135,14 +135,14 @@ class Connection(object):
|
|||||||
|
|
||||||
if do_put:
|
if do_put:
|
||||||
if doc['versioning'] == 'md5':
|
if doc['versioning'] == 'md5':
|
||||||
do_put = self.md5_versioning(doc, data)
|
do_put = self.md5_versioning(doc, newdata)
|
||||||
else:
|
else:
|
||||||
raise ValueError('unknown versioning strategy "%s"' %
|
raise ValueError('unknown versioning strategy "%s"' %
|
||||||
doc['versioning'])
|
doc['versioning'])
|
||||||
|
|
||||||
if do_put:
|
if do_put:
|
||||||
self.fs.put(data, filename=doc['url'], content_type=content_type,
|
self.fs.put(newdata, filename=doc['url'],
|
||||||
**doc['metadata'])
|
content_type=content_type, **doc['metadata'])
|
||||||
|
|
||||||
if error:
|
if error:
|
||||||
c_errors = doc.get('consecutive_errors', 0)
|
c_errors = doc.get('consecutive_errors', 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user