#NEWLINE# def create_user( self , credential , roles = [ 'ALL PRIVILEGES' ] ) : #NEWLINE# #INDENT# LOG . info ( ( 'creating user %s to %s' % ( credential . user , credential . database ) ) ) #NEWLINE# if ( credential . user in self . list_users ( ) ) : #NEWLINE# #INDENT# raise CredentialAlreadyExists ( ) #NEWLINE# #UNINDENT# self . __query ( ( "CREATE USER '%s'@'%%' IDENTIFIED BY '%s'" % ( credential . user , credential . password ) ) ) #NEWLINE# self . __query ( ( "GRANT %s ON %s.* TO '%s'@'%%'" % ( ',' . join ( roles ) , credential . database , credential . user ) ) )