Advertisement
JudeAustin

Giggity.

Sep 2nd, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. def connect(self):
  2.         self.dbh = MySQLdb.connect(
  3.             getattr(settings, 'DB_MYSQL_HOST'),
  4.             getattr(settings, 'DB_MYSQL_USER'),
  5.             getattr(settings, 'DB_MYSQL_PASS'),
  6.             getattr(settings, 'DB_MYSQL_DBNAME')
  7.         )
  8.         self.dbc = self.dbh.cursor()
  9.         self.dbh.autocommit(True)
  10.  
  11. def checkAuthentication(self, user, password):
  12.         self.execute(
  13.             """
  14.            SELECT password
  15.            FROM pool_worker
  16.            WHERE username = %s;
  17.            """, (user,)
  18.  
  19.  
  20.         )
  21.         db_password = self.dbc.fetchone()[0]
  22.         return password == db_password
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement