def _create_email_templates(): EmailTemplate.create( template_type='admin_alert_instructor_change', name='Alert admin instructor approval needed', subject_line='Instructor approval needed', message='<code>course.name</code> has new instructor(s).', ) EmailTemplate.create( template_type='admin_alert_room_change', name='Alert admin when room change', subject_line='Room change alert', message= '<code>course.name</code> has changed to a new room: <code>course.room</code>', ) EmailTemplate.create( template_type='notify_instructor_of_changes', name='I\'m the Devil. Now kindly undo these straps.', subject_line='If you\'re the Devil, why not make the straps disappear?', message='That\'s much too vulgar a display of power.', ) EmailTemplate.create( template_type='invitation', name='What an excellent day for an exorcism.', subject_line='You would like that?', message='Intensely.', ) EmailTemplate.create( template_type='recordings_scheduled', name='Recordings scheduled', subject_line='Course scheduled for Course Capture', message= 'Recordings of type <code>recording.type</code> will be published to <code>publish.type</code>.', ) std_commit(allow_test_environment=True)
def create(): params = request.get_json() 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.create( template_type=template_type, name=name, subject_line=subject_line, message=message, ) return tolerant_jsonify(email_template.to_api_json())
def _create_email_templates(): EmailTemplate.create( template_type='admin_alert_date_change', name='Scheduled course had date change', subject_line='Funky dates!', message=""" Scheduled recordings of <code>course.name</code> have invalid dates: <code>course.date.start</code> to <code>course.date.end</code>. """, ) EmailTemplate.create( template_type='admin_alert_instructor_change', name='Alert admin instructors change', subject_line='Instructors have changed', message=""" <code>course.name</code>: Old instructor(s) <code>instructors.previous</code> New instructor(s) <code>instructors.all</code> """, ) EmailTemplate.create( template_type='admin_alert_multiple_meeting_patterns', name='Alert admin when multiple meeting patterns', subject_line="It's complicated!", message=""" <code>course.name</code> has weird dates: <code>course.date.start</code> to <code>course.date.end</code> """, ) EmailTemplate.create( template_type='admin_alert_room_change', name='Alert admin when room change', subject_line='Room change alert', message= '<code>course.name</code> has changed to a new room: <code>course.room</code>', ) EmailTemplate.create( template_type='room_change_no_longer_eligible', name='Instructor alert when room change', subject_line='Room change alert', message= '<code>course.name</code> has changed to a new room: <code>course.room</code>', ) EmailTemplate.create( template_type='notify_instructor_of_changes', name="I'm the Devil. Now kindly undo these straps.", subject_line="If you're the Devil, why not make the straps disappear?", message="That's much too vulgar a display of power.", ) EmailTemplate.create( template_type='invitation', name='What an excellent day for an exorcism.', subject_line='You would like that?', message='Intensely.', ) EmailTemplate.create( template_type='recordings_scheduled', name='Recordings scheduled', subject_line='Course scheduled for Course Capture', message= 'Recordings of type <code>recording.type</code> will be published to <code>publish.type</code>.', ) EmailTemplate.create( template_type='waiting_for_approval', name='Waiting for approval', subject_line="Who's Captain Howdy?", message='You know, I make the questions and he does the answers.', ) std_commit(allow_test_environment=True)