Skip to content

Commit

Permalink
Merge pull request #9 from montymi/database
Browse files Browse the repository at this point in the history
Database
  • Loading branch information
montymi authored Apr 14, 2024
2 parents 46a6583 + 02b0fd7 commit edbc706
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/controller/dataControllerv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ def _init_database_(self):
logging.error(f'Error creating {self.database}:', e)

def _is_connected_(self):
return self.connection is not None and self.connection.is_connected()
return self.connection is not None and self.connection.is_connected()
30 changes: 27 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
from controller.dataController import DataController
import logging
import argparse

from controller.dataControllerv2 import DataController2 as DataController

def main(db):
db.connect()
print("HI")
db.disconnect()
print(type(db))

if __name__ == "__main__":
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Run unit tests with different logging levels')
parser.add_argument('-D', '--debug', action='store_const', const=logging.DEBUG, dest='log_level',
help='Set logging level to DEBUG')
parser.add_argument('-I', '--info', action='store_const', const=logging.INFO, dest='log_level',
help='Set logging level to INFO (default)')
parser.add_argument('-W', '--warning', action='store_const', const=logging.WARNING,dest='log_level',
help='Set logging level to WARNING')
parser.add_argument('-E', '--error', action='store_const', const=logging.ERROR, dest='log_level',
help='Set logging level to ERROR')
parser.add_argument('-C', '--critical', action='store_const', const=logging.CRITICAL, dest='log_level',
help='Set logging level to CRITICAL')
args = parser.parse_args()

if args.log_level is not None:
logging.basicConfig(level=args.log_level)
else:
logging.basicConfig(level=logging.INFO)

db = DataController()
main(db)
main(db)

0 comments on commit edbc706

Please sign in to comment.