Replaced lambda functions with list comprehensions.
This commit is contained in:
parent
d252e7c08f
commit
a2f685a134
1 changed files with 2 additions and 2 deletions
|
@ -347,7 +347,7 @@ def privileges_revoke(cursor, user,host,db_table,priv,grant_option):
|
||||||
query.append("FROM %s@%s")
|
query.append("FROM %s@%s")
|
||||||
query = ' '.join(query)
|
query = ' '.join(query)
|
||||||
cursor.execute(query, (user, host))
|
cursor.execute(query, (user, host))
|
||||||
priv_string = ",".join(filter(lambda x: x not in [ 'GRANT', 'REQUIRESSL' ], priv))
|
priv_string = ",".join([p for p in priv if p not in ('GRANT', 'REQUIRESSL')])
|
||||||
query = ["REVOKE %s ON %s" % (priv_string, mysql_quote_identifier(db_table, 'table'))]
|
query = ["REVOKE %s ON %s" % (priv_string, mysql_quote_identifier(db_table, 'table'))]
|
||||||
query.append("FROM %s@%s")
|
query.append("FROM %s@%s")
|
||||||
query = ' '.join(query)
|
query = ' '.join(query)
|
||||||
|
@ -357,7 +357,7 @@ def privileges_grant(cursor, user,host,db_table,priv):
|
||||||
# Escape '%' since mysql db.execute uses a format string and the
|
# Escape '%' since mysql db.execute uses a format string and the
|
||||||
# specification of db and table often use a % (SQL wildcard)
|
# specification of db and table often use a % (SQL wildcard)
|
||||||
db_table = db_table.replace('%', '%%')
|
db_table = db_table.replace('%', '%%')
|
||||||
priv_string = ",".join(filter(lambda x: x not in [ 'GRANT', 'REQUIRESSL' ], priv))
|
priv_string = ",".join([p for p in priv if p not in ('GRANT', 'REQUIRESSL')])
|
||||||
query = ["GRANT %s ON %s" % (priv_string, mysql_quote_identifier(db_table, 'table'))]
|
query = ["GRANT %s ON %s" % (priv_string, mysql_quote_identifier(db_table, 'table'))]
|
||||||
query.append("TO %s@%s")
|
query.append("TO %s@%s")
|
||||||
if 'GRANT' in priv:
|
if 'GRANT' in priv:
|
||||||
|
|
Loading…
Reference in a new issue