# HG changeset patch # User Daniele Nicolodi # Date 1309176817 -7200 # Node ID 19f233ab545fe912b2c4ca109693fc8c0283bec4 # Parent d19c5ae165de5e9350fd6495ea009d9becb785c1 Fix empty passwords handling. diff -r d19c5ae165de -r 19f233ab545f src/ltpdarepo/user.py --- 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)""",