mirror of
https://github.com/kennethreitz/records.git
synced 2026-06-05 23:00:20 +00:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user