def listImport(self, force=None, path=None): _list = request.url_rule.split('/')[2] file = request.files['file'] force = request.form.get('force') count = wl.countWhitelist() if _list.lower == 'whitelist' else bl.countBlacklist() if (count == 0) | (not count) | (force == "f"): if _list.lower == 'whitelist': wl.dropWhitelist() wl.importWhitelist(TextIOWrapper(file.stream)) else: bl.dropBlacklist() bl.importBlacklist(TextIOWrapper(file.stream)) status = _list[0]+"l_imported" else: status = _list[0]+"l_already_filled" return render_template('admin.html', status=status, **self.adminInfo())
def listImport(): _list = request.url_rule.rule.split("/")[2] file = request.files["file"] force = request.form.get("force") count = countWhitelist() if _list.lower() == "whitelist" else countBlacklist() if (count == 0) | (not count) | (force == "f"): if _list.lower() == "whitelist": dropWhitelist() importWhitelist(file.stream) else: dropBlacklist() importBlacklist(file.stream) status = _list[0] + "l_imported" else: status = _list[0] + "l_already_filled" return render_template("admin.html", status=status, **adminInfo())