aboutsummaryrefslogtreecommitdiffstats
path: root/servo/lib
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-12-05 14:27:15 +0200
committerFilipp Lepalaan <filipp@mac.com>2015-12-05 14:27:15 +0200
commit98f2848dc4618e8f5373bcdf2b85dac3ee28db0c (patch)
tree3e3faa2295a820177b95977649d62a149bbebc45 /servo/lib
parentea3518103895ad380d531502e32b03edf14cde47 (diff)
downloadServo-98f2848dc4618e8f5373bcdf2b85dac3ee28db0c.tar.gz
Servo-98f2848dc4618e8f5373bcdf2b85dac3ee28db0c.tar.bz2
Servo-98f2848dc4618e8f5373bcdf2b85dac3ee28db0c.zip
Only accept HTML order templates
Diffstat (limited to 'servo/lib')
-rw-r--r--servo/lib/utils.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/servo/lib/utils.py b/servo/lib/utils.py
index 6644a7e..2994fb3 100644
--- a/servo/lib/utils.py
+++ b/servo/lib/utils.py
@@ -8,6 +8,11 @@ from django.core.serializers.json import DjangoJSONEncoder
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
+def file_type(buf):
+ import magic
+ return magic.from_buffer(buf, mime=True)
+
+
def paginate(queryset, page, count=10):
"""
Shortcut for paginating a queryset