Enabled compliance test file in DataBase.query_file()

When requesting the file is not checked, this directory or file. It should do library
This commit is contained in:
Andrew Doroschenko
2016-02-08 12:18:36 +03:00
parent 65887b6bb5
commit b349a656db
+9
View File
@@ -122,6 +122,15 @@ class Database(object):
def query_file(self, path, params=None, fetchall=False):
"""Like Database.query, but takes a filename to load a query from."""
# If path doesn't exists
if not os.path.exists(path):
raise FileNotFoundError
# If it's a directory
if os.path.isdir(path):
raise IsADirectoryError
# Read the given .sql file into memory.
with open(path) as f:
query = f.read()