diff options
author | Manel Caro <mcaro@iseebcn.com> | 2019-03-29 14:54:24 +0100 |
---|---|---|
committer | Manel Caro <mcaro@iseebcn.com> | 2019-03-29 14:54:24 +0100 |
commit | 77355baca0f628f5e95cbf1d8bf3c2475a95150f (patch) | |
tree | ed31cbe8ddc54b09ec471db0e033b33a9073748b /test-cli/test/helpers/psqldb.py | |
parent | b44174ae3decc9f9498541ce9aeed84ce183a9eb (diff) | |
download | board-77355baca0f628f5e95cbf1d8bf3c2475a95150f.zip board-77355baca0f628f5e95cbf1d8bf3c2475a95150f.tar.gz board-77355baca0f628f5e95cbf1d8bf3c2475a95150f.tar.bz2 |
Modify database connection object and xml parser object
Diffstat (limited to 'test-cli/test/helpers/psqldb.py')
-rw-r--r-- | test-cli/test/helpers/psqldb.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/test-cli/test/helpers/psqldb.py b/test-cli/test/helpers/psqldb.py index 26dd03d..ad40618 100644 --- a/test-cli/test/helpers/psqldb.py +++ b/test-cli/test/helpers/psqldb.py @@ -1,13 +1,14 @@ import psycopg2 + class PgSQLConnection(object): - """aaaaaaa""" + """Database Connection Object""" __conection_object = None __db_config = {'dbname': 'testsrv', 'host': '192.168.2.171', 'password': 'Idkfa2009', 'port': 5432, 'user': 'admin'} - def __init__ (self): + def __init__(self): # self.__conection_object = None # if connect_str is not None: # self.__db_config = connect_str @@ -15,10 +16,10 @@ class PgSQLConnection(object): self.__db_config = {'dbname': 'testsrv', 'host': '192.168.2.171', 'password': 'Idkfa2009', 'port': 5432, 'user': 'admin'} - def db_connect (self, connect_str): + def db_connect(self, connect_str): result = False try: - if connect_str == None: + if connect_str is None: self.__conection_object = psycopg2.connect(**self.__db_config) else: self.__db_config = connect_str; @@ -39,14 +40,12 @@ class PgSQLConnection(object): def commit(self): self.__conection_object.commit() - def db_close(self): if self.__conection_object is not None: self.__conection_object.close() del self.__conection_object self.__conection_object = None - def __del__(self): if self.__conection_object is not None: self.__conection_object.close() |