mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
Updated for pr comments
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
from flask import (
|
||||
Blueprint,
|
||||
jsonify,
|
||||
request,
|
||||
current_app)
|
||||
request
|
||||
)
|
||||
|
||||
from app.dao.jobs_dao import (
|
||||
dao_create_job,
|
||||
@@ -43,7 +43,7 @@ def get_jobs_by_service(service_id):
|
||||
try:
|
||||
limit_days = int(request.args['limit_days'])
|
||||
except ValueError as e:
|
||||
errors = {'error': ['{} is not an integer'.format(request.args['limit_days'])]}
|
||||
errors = {'limit_days': ['{} is not an integer'.format(request.args['limit_days'])]}
|
||||
raise InvalidRequest(errors, status_code=400)
|
||||
else:
|
||||
limit_days = None
|
||||
|
||||
@@ -292,6 +292,9 @@ def send_notification(notification_type):
|
||||
sms_template_notification_schema if notification_type == 'sms' else email_notification_schema
|
||||
).load(request.get_json())
|
||||
|
||||
if errors:
|
||||
raise InvalidRequest(errors, status_code=400)
|
||||
|
||||
template = templates_dao.dao_get_template_by_id_and_service_id(
|
||||
template_id=notification['template'],
|
||||
service_id=service_id
|
||||
|
||||
@@ -29,10 +29,7 @@ register_errors(template)
|
||||
|
||||
def _content_count_greater_than_limit(content, template_type):
|
||||
template = Template({'content': content, 'template_type': template_type})
|
||||
if template_type == 'sms' and \
|
||||
template.content_count > current_app.config.get('SMS_CHAR_COUNT_LIMIT'):
|
||||
return True
|
||||
return False
|
||||
return template_type == 'sms' and template.content_count > current_app.config.get('SMS_CHAR_COUNT_LIMIT')
|
||||
|
||||
|
||||
@template.route('', methods=['POST'])
|
||||
|
||||
Reference in New Issue
Block a user