def process_costars_upload(): filepath = request.form.get('filepath') filename = request.form.get('filename') delete = request.form.get('_delete') try: import_costars(filepath, filename, None, None, None) if delete not in ['False', 'false', False]: os.remove(filepath) return jsonify({'status': 'success'}), 200 except Exception, e: return jsonify({'status': 'error: {}'.format(e)}), 500
def process_costars_upload(): '''Perform the costars upload on the saved file .. seealso:: :ref:`costars-importer` :status 200: successful costars file read and upload :status 500: error reading costars file ''' filepath = request.form.get('filepath') filename = request.form.get('filename') delete = request.form.get('_delete') try: import_costars(filepath, filename, None, None, None) if delete not in ['False', 'false', False]: os.remove(filepath) return jsonify({'status': 'success'}), 200 except Exception, e: return jsonify({'status': 'error: {}'.format(e)}), 500