More db logging, db testcase, dont allow to request files from root db dir

This commit is contained in:
HelloZeroNet 2015-04-01 03:05:09 +02:00
parent 10c6d4a7a3
commit 2491814070
3 changed files with 48 additions and 4 deletions

View file

@ -16,9 +16,12 @@ class Db:
def connect(self):
self.log.debug("Connecting (sqlite version: %s)..." % sqlite3.version)
self.log.debug("Connecting to %s (sqlite version: %s)..." % (self.db_path, sqlite3.version))
if not os.path.isdir(self.db_dir): # Directory not exits yet
os.makedirs(self.db_dir)
self.log.debug("Created Db path: %s" % self.db_dir)
if not os.path.isfile(self.db_path):
self.log.debug("Db file not exits yet: %s" % self.db_path)
self.conn = sqlite3.connect(self.db_path)
self.conn.row_factory = sqlite3.Row
self.conn.isolation_level = None