Save line if present when storing object errors

This commit is contained in:
amercader 2012-11-20 11:39:37 +00:00
parent 7113466760
commit 6cf7f79942
1 changed files with 7 additions and 3 deletions

View File

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