requested changes

This commit is contained in:
Bruce Pennypacker 2015-01-08 21:41:15 +00:00 committed by Matt Clay
parent 9cbe3eb8ae
commit 605a5a5b53

View file

@ -317,10 +317,7 @@ def privileges_revoke(cursor, user,host,db_table,grant_option):
query = ["REVOKE ALL PRIVILEGES ON %s" % mysql_quote_identifier(db_table, 'table')] query = ["REVOKE ALL PRIVILEGES ON %s" % mysql_quote_identifier(db_table, 'table')]
query.append("FROM %s@%s") query.append("FROM %s@%s")
query = ' '.join(query) query = ' '.join(query)
try:
cursor.execute(query, (user, host)) cursor.execute(query, (user, host))
except Exception, e:
raise Exception("%s. Query=\"%s\"" % (str(e), query % (user, host)))
def privileges_grant(cursor, user,host,db_table,priv): 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
@ -334,12 +331,7 @@ def privileges_grant(cursor, user,host,db_table,priv):
if 'REQUIRESSL' in priv: if 'REQUIRESSL' in priv:
query.append("REQUIRE SSL") query.append("REQUIRE SSL")
query = ' '.join(query) query = ' '.join(query)
try:
cursor.execute(query, (user, host)) cursor.execute(query, (user, host))
except Exception, e:
raise Exception("%s. Query=\"%s\"" % (str(e), query % (user, host)))
def strip_quotes(s): def strip_quotes(s):
""" Remove surrounding single or double quotes """ Remove surrounding single or double quotes