From 361e4295a86fb24e5c7961d9621819e9a43b3bb8 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Wed, 30 Aug 2023 18:45:39 -0400 Subject: improve syntax --- newspipe/bootstrap.py | 1 - newspipe/controllers/user.py | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/newspipe/bootstrap.py b/newspipe/bootstrap.py index ac8147c7..9160c857 100644 --- a/newspipe/bootstrap.py +++ b/newspipe/bootstrap.py @@ -53,7 +53,6 @@ class ReverseProxied(object): environ['SCRIPT_NAME'] = self.script_name return self.app(environ, start_response) - # Create Flask application application = Flask(__name__, instance_relative_config=True) configuration = os.environ.get("NEWSPIPE_CONFIG", False) diff --git a/newspipe/controllers/user.py b/newspipe/controllers/user.py index 77bcc9be..c073ee5f 100644 --- a/newspipe/controllers/user.py +++ b/newspipe/controllers/user.py @@ -125,11 +125,9 @@ class LdapuserController(object): namelist = [] try: query = dns.resolver.query(f"_ldap._tcp.{domain}","SRV") - except dns.resolver.NXDOMAIN: + except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer): # no records exist that match the request, so we were probably given a specific hostname, and an empty query will trigger the logic below that will add the original domain to the list. query = [] - except dns.resolver.NoAnswer: - query = [] for i in query: namelist.append(i.target.to_text().rstrip(".")) if not len(namelist): -- cgit