diff options
Diffstat (limited to 'app/views/utils.py')
-rw-r--r-- | app/views/utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/views/utils.py b/app/views/utils.py new file mode 100644 index 0000000..7a5303e --- /dev/null +++ b/app/views/utils.py @@ -0,0 +1,9 @@ +from flask import request + +def isFilenameAllowed(filename, exts): + return "." in filename and \ + filename.rsplit(".", 1)[1].lower() in exts + +def shouldReturnJson(): + return "application/json" in request.accept_mimetypes and \ + not "text/html" in request.accept_mimetypes |