Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
Improvements on the error email sending
Browse files Browse the repository at this point in the history
  • Loading branch information
vegitron committed Sep 20, 2016
1 parent a3b6dd0 commit f81b169
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sqlshare_rest/util/dataset_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ def email_owner_success(dataset):
logger.error("Unable to send email to %s. Error: %s" % (to,
str(ex)))

def email_owner_failure(dataset):
to = dataset.owner.get_email()
def email_owner_failure(upload):
to = upload.owner.get_email()
values = {}

values['name'] = dataset.name
values['name'] = upload.dataset_name

text_version = render_to_string('uploaded_email/fail-text.html',
values)
Expand Down Expand Up @@ -127,6 +127,7 @@ def start_upload(upload, background=True):
# relatively ok if that fails
pass
finally:
upload = FileUpload.objects.get(pk=upload_id)
email_owner_failure(upload)
import traceback
tb = traceback.format_exc()
Expand Down Expand Up @@ -187,6 +188,7 @@ def process_upload(upload_id):
upload.has_error = True
upload.error = str(ex)
upload.save()
raise
finally:
backend.close_user_connection(user)

Expand Down

0 comments on commit f81b169

Please sign in to comment.