def update(): params = request.get_json() template_id = params.get('templateId') email_template = EmailTemplate.get_template( template_id) if template_id else None if email_template: template_type = params.get('templateType') name = params.get('name') subject_line = params.get('subjectLine') message = params.get('message') if None in [template_type, name, subject_line, message]: raise BadRequestError('Required parameters are missing.') email_template = EmailTemplate.update( template_id=template_id, template_type=template_type, name=name, subject_line=subject_line, message=message, ) return tolerant_jsonify(email_template.to_api_json()) else: raise ResourceNotFoundError('No such email template')
def get_blackout(blackout_id): blackout = Blackout.get_blackout(blackout_id) if blackout: return tolerant_jsonify(blackout.to_api_json()) else: raise ResourceNotFoundError('No such blackout')
def get_email_template(template_id): email_template = EmailTemplate.get_template(template_id) if email_template: return tolerant_jsonify(email_template.to_api_json()) else: raise ResourceNotFoundError('No such email_template')