mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
Fixed merge conflicts with master.
Code quality fixes.
This commit is contained in:
@@ -25,7 +25,6 @@ from app.main.uploader import (
|
||||
s3upload,
|
||||
s3download
|
||||
)
|
||||
from app.main.dao import templates_dao
|
||||
from app import (job_api_client, service_api_client)
|
||||
from app.utils import user_has_permissions, get_errors_for_csv
|
||||
|
||||
@@ -81,7 +80,7 @@ def choose_template(service_id, template_type):
|
||||
Template(
|
||||
template,
|
||||
prefix=service['name']
|
||||
) for template in templates_dao.get_service_templates(service_id)['data']
|
||||
) for template in service_api_client.get_service_templates(service_id)['data']
|
||||
if template['template_type'] == template_type
|
||||
],
|
||||
template_type=template_type,
|
||||
@@ -99,7 +98,7 @@ def send_messages(service_id, template_id):
|
||||
|
||||
service = service_api_client.get_service(service_id)['data']
|
||||
template = Template(
|
||||
templates_dao.get_service_template_or_404(service_id, template_id)['data'],
|
||||
service_api_client.get_service_template(service_id, template_id)['data'],
|
||||
prefix=service['name']
|
||||
)
|
||||
|
||||
@@ -143,7 +142,11 @@ def send_messages(service_id, template_id):
|
||||
@login_required
|
||||
@user_has_permissions('send_texts', 'send_emails', 'send_letters', 'manage_templates', or_=True)
|
||||
def get_example_csv(service_id, template_id):
|
||||
template = Template(templates_dao.get_service_template_or_404(service_id, template_id)['data'])
|
||||
template = Template(service_api_client.get_service_template(service_id, template_id)['data'])
|
||||
# Good practice to use context managers
|
||||
# http://stackoverflow.com/questions/9718950/do-i-have-to-do-stringio-close
|
||||
# For this instance it may not be a problem but someone else looking at the
|
||||
# code may assume its always safe when it might not be.
|
||||
output = io.StringIO()
|
||||
writer = csv.writer(output)
|
||||
writer.writerow(
|
||||
@@ -163,7 +166,11 @@ def get_example_csv(service_id, template_id):
|
||||
@login_required
|
||||
@user_has_permissions('send_texts', 'send_emails', 'send_letters')
|
||||
def send_message_to_self(service_id, template_id):
|
||||
template = Template(templates_dao.get_service_template_or_404(service_id, template_id)['data'])
|
||||
template = Template(service_api_client.get_service_template(service_id, template_id)['data'])
|
||||
# Good practice to use context managers
|
||||
# http://stackoverflow.com/questions/9718950/do-i-have-to-do-stringio-close
|
||||
# For this instance it may not be a problem but someone else looking at the
|
||||
# code may assume its always safe when it might not be.
|
||||
output = io.StringIO()
|
||||
writer = csv.writer(output)
|
||||
writer.writerow(
|
||||
@@ -199,7 +206,7 @@ def send_message_to_self(service_id, template_id):
|
||||
@user_has_permissions('manage_api_keys', 'access_developer_docs')
|
||||
def send_from_api(service_id, template_id):
|
||||
template = Template(
|
||||
templates_dao.get_service_template_or_404(service_id, template_id)['data']
|
||||
service_api_client.get_service_template(service_id, template_id)['data']
|
||||
)
|
||||
payload = {
|
||||
"to": current_user.mobile_number,
|
||||
@@ -230,7 +237,7 @@ def check_messages(service_id, template_type, upload_id):
|
||||
if not contents:
|
||||
flash('There was a problem reading your upload file')
|
||||
|
||||
template = templates_dao.get_service_template_or_404(
|
||||
template = service_api_client.get_service_template(
|
||||
service_id,
|
||||
session['upload_data'].get('template_id')
|
||||
)['data']
|
||||
|
||||
Reference in New Issue
Block a user