summaryrefslogtreecommitdiff
path: root/test-cli/test/helpers/psqldb.py
diff options
context:
space:
mode:
Diffstat (limited to 'test-cli/test/helpers/psqldb.py')
-rw-r--r--test-cli/test/helpers/psqldb.py11
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()