diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-13 17:20:59 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-13 17:20:59 +0200 |
commit | e00ef98491f79ae8aa972ae1473dae4a7b78c07e (patch) | |
tree | 31be0c7cdcebb61525bcc387bcf15d265a1c494a /pyload/webui | |
parent | Fix except (diff) | |
download | pyload-e00ef98491f79ae8aa972ae1473dae4a7b78c07e.tar.xz |
Cleanup
Diffstat (limited to 'pyload/webui')
-rw-r--r-- | pyload/webui/app/cnl.py | 2 | ||||
-rw-r--r-- | pyload/webui/app/utils.py | 5 | ||||
-rw-r--r-- | pyload/webui/filters.py | 2 | ||||
-rw-r--r-- | pyload/webui/middlewares.py | 8 |
4 files changed, 17 insertions, 0 deletions
diff --git a/pyload/webui/app/cnl.py b/pyload/webui/app/cnl.py index dee0f2341..51767033f 100644 --- a/pyload/webui/app/cnl.py +++ b/pyload/webui/app/cnl.py @@ -16,6 +16,8 @@ except Exception: def local_check(function): + + def _view(*args, **kwargs): if request.environ.get("REMOTE_ADDR", "0") in ("127.0.0.1", "localhost") \ or request.environ.get("HTTP_HOST", "0") in ("127.0.0.1:9666", "localhost:9666"): diff --git a/pyload/webui/app/utils.py b/pyload/webui/app/utils.py index 4a431493b..ac7fa84fb 100644 --- a/pyload/webui/app/utils.py +++ b/pyload/webui/app/utils.py @@ -84,7 +84,11 @@ def parse_userdata(session): def login_required(perm=None): + + def _dec(func): + + def _view(*args, **kwargs): s = request.environ.get('beaker.session') if s.get("name", None) and s.get("authenticated", False): @@ -116,6 +120,7 @@ def toDict(obj): class CherryPyWSGI(ServerAdapter): + def run(self, handler): from wsgiserver import CherryPyWSGIServer diff --git a/pyload/webui/filters.py b/pyload/webui/filters.py index 527b18446..c784b248d 100644 --- a/pyload/webui/filters.py +++ b/pyload/webui/filters.py @@ -8,6 +8,8 @@ try: from os.path import relpath except Exception: from posixpath import curdir, sep, pardir + + def relpath(path, start=curdir): """Return a relative version of a path""" if not path: diff --git a/pyload/webui/middlewares.py b/pyload/webui/middlewares.py index 19328f9ef..26537f900 100644 --- a/pyload/webui/middlewares.py +++ b/pyload/webui/middlewares.py @@ -8,19 +8,23 @@ except ImportError: from StringIO import StringIO class StripPathMiddleware(object): + def __init__(self, app): self.app = app + def __call__(self, e, h): e['PATH_INFO'] = e['PATH_INFO'].rstrip('/') return self.app(e, h) class PrefixMiddleware(object): + def __init__(self, app, prefix="/pyload"): self.app = app self.prefix = prefix + def __call__(self, e, h): path = e["PATH_INFO"] if path.startswith(self.prefix): @@ -42,6 +46,7 @@ class GZipMiddleWare(object): self.application = application self.compress_level = int(compress_level) + def __call__(self, environ, start_response): if 'gzip' not in environ.get('HTTP_ACCEPT_ENCODING', ''): # nothing for us to do, so this middleware will @@ -80,6 +85,7 @@ class GzipResponse(object): self.content_length = None self.headers = () + def gzip_start_response(self, status, headers, exc_info=None): self.headers = headers ct = header_value(headers,'content-type') @@ -102,6 +108,7 @@ class GzipResponse(object): self.status = status return self.buffer.write + def write(self): out = self.buffer out.seek(0) @@ -109,6 +116,7 @@ class GzipResponse(object): out.close() return [s] + def finish_response(self, app_iter): if self.compressible: output = gzip.GzipFile(mode='wb', compresslevel=self.compress_level, |