(project_string_id)
| 18 | apis_user_list = ['api_enabled_builder', 'security_email_verified']) |
| 19 | @limiter.limit("300 per day") |
| 20 | def api_input_update(project_string_id): |
| 21 | """ |
| 22 | |
| 23 | """ |
| 24 | spec_list = [ |
| 25 | {'id_list': list}, |
| 26 | {"mode": { |
| 27 | 'kind': str, |
| 28 | 'valid_values_list': ["ARCHIVE", "RETRY"] |
| 29 | } |
| 30 | } |
| 31 | ] |
| 32 | |
| 33 | log, input, untrusted_input = regular_input.master(request = request, |
| 34 | spec_list = spec_list) |
| 35 | if len(log["error"].keys()) >= 1: |
| 36 | return jsonify(log = log), 400 |
| 37 | |
| 38 | with sessionMaker.session_scope() as session: |
| 39 | |
| 40 | user = User.get(session = session) |
| 41 | project = Project.get(session, project_string_id) |
| 42 | |
| 43 | # TODO somehow validate that input list is a list of ints? |
| 44 | |
| 45 | input_list = session.query(Input).filter( |
| 46 | Input.id.in_(input['id_list']), |
| 47 | Input.project_id == project.id).all() |
| 48 | if not input_list: |
| 49 | log['error']['id_list'] = "None found." |
| 50 | return jsonify(log = log), 400 |
| 51 | |
| 52 | if input['mode'] == "RETRY": |
| 53 | update_input = Update_Input( |
| 54 | session = session, |
| 55 | input_list = input_list) |
| 56 | |
| 57 | update_input.retry_file_list() |
| 58 | |
| 59 | if len(update_input.log["error"].keys()) >= 1: |
| 60 | return jsonify(log = update_input.log), 400 |
| 61 | |
| 62 | if input['mode'] == "ARCHIVE": |
| 63 | update_input = Update_Input( |
| 64 | session = session, |
| 65 | input_list = input_list) |
| 66 | |
| 67 | update_input.archive_input() |
| 68 | |
| 69 | log['success'] = True |
| 70 | |
| 71 | return jsonify(log = log), 200 |
| 72 | |
| 73 | |
| 74 | def report_input_forever(): |
nothing calls this directly
no test coverage detected