Save line if present when storing object errors
This commit is contained in:
parent
7113466760
commit
6cf7f79942
|
@ -111,15 +111,19 @@ class SpatialHarvester(object):
|
|||
finally:
|
||||
log.error(message)
|
||||
|
||||
def _save_object_error(self,message,obj,stage=u'Fetch'):
|
||||
err = HarvestObjectError(message=message,object=obj,stage=stage)
|
||||
def _save_object_error(self,message,obj,stage=u'Fetch',line=None):
|
||||
err = HarvestObjectError(message=message,
|
||||
object=obj,
|
||||
stage=stage,
|
||||
line=line)
|
||||
try:
|
||||
err.save()
|
||||
except InvalidRequestError,e:
|
||||
Session.rollback()
|
||||
err.save()
|
||||
finally:
|
||||
log.error(message)
|
||||
log_message = '{0}, line {1}'.format(message,line) if line else message
|
||||
log.error(log_message)
|
||||
|
||||
def _get_content(self, url):
|
||||
url = url.replace(' ','%20')
|
||||
|
|
Loading…
Reference in New Issue