Sets all class attributes and tries to open the connection
(self, host, login, passwd, conn)
| 47 | """ |
| 48 | |
| 49 | def __init__(self, host, login, passwd, conn): |
| 50 | """ |
| 51 | Sets all class attributes and tries to open the connection |
| 52 | """ |
| 53 | # connection lock is used to lock all changes to the connection state attributes |
| 54 | # (connection and last_error) |
| 55 | self.connection_state_lock = threading.Lock() |
| 56 | self.connection = None |
| 57 | self.last_error = None |
| 58 | |
| 59 | # credentials |
| 60 | self.host = host |
| 61 | self.login = login |
| 62 | self.passwd = passwd |
| 63 | self.type = conn |
| 64 | |
| 65 | # connect |
| 66 | self.connect() |
| 67 | |
| 68 | def connect(self): |
| 69 | self.connection_state_lock.acquire() |