Use identity operators for comparison to None singleton.
PEP 8 specifies: * Comparisons to singletons like None should always be done with `is` or `is not`, never the equality operators.
This commit is contained in:
parent
4bed400c7d
commit
7118641d78
1 changed files with 3 additions and 3 deletions
|
@ -138,16 +138,16 @@ def get_password(user, host):
|
||||||
cursor.execute(db_query_getpass, {"user": user.lower(), "host": host})
|
cursor.execute(db_query_getpass, {"user": user.lower(), "host": host})
|
||||||
data = cursor.fetchone()
|
data = cursor.fetchone()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
return data[0] if data != None else None
|
return data[0] if data is not None else None
|
||||||
|
|
||||||
|
|
||||||
def isuser(user, host):
|
def isuser(user, host):
|
||||||
return get_password(user, host) != None
|
return get_password(user, host) is not None
|
||||||
|
|
||||||
|
|
||||||
def auth(user, host, password):
|
def auth(user, host, password):
|
||||||
db_password = get_password(user, host)
|
db_password = get_password(user, host)
|
||||||
if db_password == None:
|
if db_password is None:
|
||||||
logging.debug("Wrong username: %s@%s" % (user, host))
|
logging.debug("Wrong username: %s@%s" % (user, host))
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue