Error in task when letter template and in trial mode

This commit is contained in:
Ken Tsang
2017-08-25 16:11:39 +01:00
parent 41a71c703b
commit 7e70b44113
3 changed files with 35 additions and 1 deletions

View File

@@ -75,6 +75,13 @@ def process_job(job_id):
db_template = dao_get_template_by_id(job.template_id, job.template_version)
if db_template.template_type == LETTER_TYPE and service.restricted:
job.job_status = JOB_STATUS_ERROR
dao_update_job(job)
current_app.logger.warn(
"Job {} has been set to error, service {} is in trial mode".format(job_id, service.id))
return
TemplateClass = get_template_class(db_template.template_type)
template = TemplateClass(db_template.__dict__)