- 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

@@ -1,4 +1,3 @@
import uuid
import pytz
from datetime import (
datetime,
@@ -12,7 +11,7 @@ from werkzeug.datastructures import MultiDict
from sqlalchemy import (desc, func, or_, and_, asc, cast, Text)
from sqlalchemy.orm import joinedload
from app import db
from app import db, create_uuid
from app.dao import days_ago
from app.models import (
Service,
@@ -125,7 +124,7 @@ def dao_get_last_template_usage(template_id):
def dao_create_notification(notification):
if not notification.id:
# need to populate defaulted fields before we create the notification history object
notification.id = uuid.uuid4()
notification.id = create_uuid()
if not notification.status:
notification.status = 'created'