diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-10-07 19:52:31 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-10-07 19:52:43 +0200 |
commit | 7e6bd572a64177e1648a52829f077415180daa1f (patch) | |
tree | 0d6309cfec294aea6f3e2ddddea13481f996f5b5 /pyload/web/utils.py | |
parent | Checksum: reverted b2e7352 due to a case sensitive issue (diff) | |
download | pyload-7e6bd572a64177e1648a52829f077415180daa1f.tar.xz |
gzip compression for api
Diffstat (limited to 'pyload/web/utils.py')
-rw-r--r-- | pyload/web/utils.py | 10 |
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): |