@cases_bp.route('<STR_LIT>', methods=['<STR_LIT:POST>'])<EOL>@cases_bp.route('<STR_LIT>', methods=['<STR_LIT:POST>'])<EOL>def events(institute_id, case_name, event_id=None):
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)<EOL>link = request.form.get('<STR_LIT>')<EOL>content = request.form.get('<STR_LIT:content>')<EOL>variant_id = request.args.get('<STR_LIT>')<EOL>user_obj = store.user(current_user.email)<EOL>if event_id:<EOL><INDENT>store.delete_event(event_id)<EOL><DEDENT>else:<EOL><INDENT>if variant_id:<EOL><INDENT>variant_obj = store.variant(variant_id)<EOL>level = request.form.get('<STR_LIT>', '<STR_LIT>')<EOL>store.comment(institute_obj, case_obj, user_obj, link,<EOL>variant=variant_obj, content=content, comment_level=level)<EOL><DEDENT>else:<EOL><INDENT>store.comment(institute_obj, case_obj, user_obj, link, content=content)<EOL><DEDENT><DEDENT>return redirect(request.referrer)<EOL>
Handle events.