diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-03-23 17:33:34 +0000 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-03-23 17:35:43 +0000 |
commit | 269c8c0eb4c3f66cdf778f313c84163d51f04bad (patch) | |
tree | 31177ba66332e90b1fad1f09d3a8e39f263fbad6 /app/views/utils.py | |
parent | 2a836c10009f1df6e280dd5a2f13d0a23af8e30e (diff) | |
download | cheatdb-269c8c0eb4c3f66cdf778f313c84163d51f04bad.tar.xz |
Add packages API
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 |