- Refactor version 1 of post notificaitons to use the common persist_notificaiton and send_notification_to_queue methods.

- It would be nice to refactor the send_sms and send_email tasks to use these common functions as well, that way I can get rid of the new Notifications.from_v2_api_request method.
- Still not happy with the format of the errors. Would like to find a happy place, where the message is descript enough that we do not need external documentation to explain the error. Perhaps we still only need documentation to explain the trial mode concept.
This commit is contained in:
Rebecca Law
2016-10-28 17:10:00 +01:00
parent 6e4bad135a
commit 8cf2fc72a8
11 changed files with 109 additions and 145 deletions

View File

@@ -22,7 +22,7 @@ from app.authentication.utils import get_secret
from app import (
db,
encryption,
DATETIME_FORMAT, create_uuid)
DATETIME_FORMAT)
from app.history_meta import Versioned
@@ -573,13 +573,12 @@ class Notification(db.Model):
api_key_id,
key_type):
return cls(
id=create_uuid(),
template_id=template_id,
template_version=template_version,
to=recipient,
service_id=service_id,
status='created',
created_at=datetime.datetime.strftime(datetime.datetime.utcnow(), DATETIME_FORMAT),
created_at=datetime.datetime.utcnow(),
personalisation=personalisation,
notification_type=notification_type,
api_key_id=api_key_id,