def create_external_export(username, id_string, export_id, query=None,
token=None, meta=None):
export = Export.objects.get(id=export_id)
try:
# though export is not available when for has 0 submissions, we
# catch this since it potentially stops celery
gen_export = generate_external_export(
Export.EXTERNAL_EXPORT, username,
id_string, export_id, token, query, meta
)
except (Exception, NoRecordsFoundError, ConnectionError) as e:
export.internal_status = Export.FAILED
export.save()
# mail admins
details = {
'export_id': export_id,
'username': username,
'id_string': id_string
}
report_exception("External Export Exception: Export ID - "
"%(export_id)s, /%(username)s/%(id_string)s"
% details, e, sys.exc_info())
raise
else:
return gen_export.id
评论列表
文章目录