enforce lower case chars on add/import

levin
lza_menace 4 years ago
parent ea2834eedb
commit 5cda6ecf81

@ -82,7 +82,7 @@ def add():
flash("This doesn\"t look like a valid URL") flash("This doesn\"t look like a valid URL")
else: else:
_url = urlparse(url) _url = urlparse(url)
url = f"{_url.scheme}://{_url.netloc}" url = f"{_url.scheme}://{_url.netloc}".lower()
if Node.select().where(Node.url == url).exists(): if Node.select().where(Node.url == url).exists():
flash("This node is already in the database.") flash("This node is already in the database.")
else: else:
@ -187,7 +187,7 @@ def import_():
with open(export_dir, 'r') as f: with open(export_dir, 'r') as f:
for url in f.readlines(): for url in f.readlines():
try: try:
n = url.rstrip() n = url.rstrip().lower()
logging.info(f"Adding {n}") logging.info(f"Adding {n}")
node = Node(url=n) node = Node(url=n)
node.save() node.save()

Loading…
Cancel
Save