summaryrefslogtreecommitdiffstats
path: root/pyload/web/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/web/utils.py')
-rw-r--r--pyload/web/utils.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/pyload/web/utils.py b/pyload/web/utils.py
index e94089185..7e8ee3f13 100644
--- a/pyload/web/utils.py
+++ b/pyload/web/utils.py
@@ -4,14 +4,21 @@
import re
from bottle import request, HTTPError, redirect
+try:
+ import zlib
+except ImportError:
+ zlib = None
+
from webinterface import PYLOAD, SETUP
+
def add_json_header(r):
r.headers.replace("Content-type", "application/json")
r.headers.append("Cache-Control", "no-cache, must-revalidate")
r.headers.append("Access-Control-Allow-Origin", request.get_header('Origin', '*'))
r.headers.append("Access-Control-Allow-Credentials", "true")
+
def set_session(request, user):
s = request.environ.get('beaker.session')
s["uid"] = user.uid
@@ -58,15 +65,14 @@ def is_mobile():
return True
return False
-def select_language(langs):
+def select_language(langs):
accept = request.headers.get('Accept-Language', '')
# TODO
return langs[0]
-
def login_required(perm=None):
def _dec(func):
def _view(*args, **kwargs):