def addprovider_func(name=None): hostname = str(request.form['hostname']).strip() filepath = str(request.form['filepath']).strip() if not len(filepath) is 0 and not len(hostname) is 0: file_size = Utils.fileSize(filepath) FileProvider.add_new_file_provider(hostname, filepath, file_size) return make_response(render_template('provider_added.html'), 200)
def removeprovider_func(name=None): received_data_as_json = json.loads(request.data.decode()) hostname_to_remove = received_data_as_json['hostname'] FileProvider.remove_provider(hostname_to_remove) print("Provider with hostname {} has been removed with all history!".format(hostname_to_remove)) return redirect(url_for('addprovider'))