def send_notification(service_id, template_id): if {'recipient', 'placeholders'} - set(session.keys()): return redirect(url_for( '.send_one_off', service_id=service_id, template_id=template_id, )) try: noti = notification_api_client.send_notification( service_id, template_id=template_id, recipient=session['recipient'], personalisation=session['placeholders'], sender_id=session['sender_id'] if 'sender_id' in session else None ) except HTTPError as exception: current_app.logger.info('Service {} could not send notification: "{}"'.format( current_service['id'], exception.message )) return _check_notification(service_id, template_id, exception) session.pop('placeholders') session.pop('recipient') session.pop('sender_id', None) return redirect(url_for( '.view_notification', service_id=service_id, notification_id=noti['id'], help=request.args.get('help') ))
def send_notification(service_id, template_id): if {"recipient", "placeholders"} - set(session.keys()): return redirect( url_for( ".send_one_off", service_id=service_id, template_id=template_id, )) db_template = current_service.get_template_with_user_permission_or_403( template_id, current_user) try: noti = notification_api_client.send_notification( service_id, template_id=db_template["id"], recipient=session["recipient"] or session["placeholders"]["address line 1"], personalisation=session["placeholders"], sender_id=session["sender_id"] if "sender_id" in session else None, ) except HTTPError as exception: current_app.logger.info( 'Service {} could not send notification: "{}"'.format( current_service.id, exception.message)) return render_template( "views/notifications/check.html", **_check_notification(service_id, template_id, exception), ) session.pop("placeholders") session.pop("recipient") session.pop("sender_id", None) session.pop("send_step", None) return redirect( url_for( ".view_notification", service_id=service_id, notification_id=noti["id"], help=request.args.get("help"), just_sent=True, ))
def send_notification(service_id, template_id): if {'recipient', 'placeholders'} - set(session.keys()): return redirect( url_for( '.send_one_off', service_id=service_id, template_id=template_id, )) db_template = current_service.get_template_with_user_permission_or_403( template_id, current_user) try: noti = notification_api_client.send_notification( service_id, template_id=db_template['id'], recipient=session['recipient'] or Columns(session['placeholders'])['address line 1'], personalisation=session['placeholders'], sender_id=session['sender_id'] if 'sender_id' in session else None) except HTTPError as exception: current_app.logger.info( 'Service {} could not send notification: "{}"'.format( current_service.id, exception.message)) return render_template( 'views/notifications/check.html', **_check_notification(service_id, template_id, exception), ) session.pop('placeholders') session.pop('recipient') session.pop('sender_id', None) return redirect( url_for( '.view_notification', service_id=service_id, notification_id=noti['id'], # used to show the final step of the tour (help=3) or not show # a back link on a just sent one off notification (help=0) help=request.args.get('help')))