Mercurial > hg > ltpdarepo
changeset 21:19f233ab545f
Fix empty passwords handling.
author | Daniele Nicolodi <daniele@grinta.net> |
---|---|
date | Mon, 27 Jun 2011 14:13:37 +0200 |
parents | d19c5ae165de |
children | f27d3de11568 |
files | src/ltpdarepo/user.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ltpdarepo/user.py Mon Jun 27 14:13:21 2011 +0200 +++ b/src/ltpdarepo/user.py Mon Jun 27 14:13:37 2011 +0200 @@ -111,16 +111,16 @@ conn.commit() - def passwd(self, password=''): - if not password: - password = _generate_password() - self.password = password + def passwd(self, password=None): + if password is not None: + self.password = password + if not self.password: + self.password = _generate_password() conn = connection() curs = conn.cursor() - curs.execute("""SELECT Host FROM mysql.user WHERE User=%s""", - (self.username, )) + curs.execute("""SELECT Host FROM mysql.user WHERE User=%s""", self.username) hosts = [row[0] for row in curs.fetchall()] for host in hosts: curs.execute("""SET PASSWORD FOR %s@%s = PASSWORD(%s)""",