diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-12-16 23:45:21 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-12-16 23:45:21 +0100 |
commit | aea618c1bffe9ea6eb44b8555f17349b39dfe22b (patch) | |
tree | 407b9a864ad9733eecdd4eb7b247af554c450858 /module/web/ajax/views.py | |
parent | merged (diff) | |
download | pyload-aea618c1bffe9ea6eb44b8555f17349b39dfe22b.tar.xz |
new functions for interacting with core
Diffstat (limited to 'module/web/ajax/views.py')
-rw-r--r-- | module/web/ajax/views.py | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/module/web/ajax/views.py b/module/web/ajax/views.py index c4395a659..05c91597f 100644 --- a/module/web/ajax/views.py +++ b/module/web/ajax/views.py @@ -6,28 +6,7 @@ from django.conf import settings from django.shortcuts import render_to_response from django.utils import simplejson from django.core.serializers import json - -def check_server(function): - def _dec(view_func): - def _view(request, *args, **kwargs): - try: - version = settings.PYLOAD.get_server_version() - except Exception, e: - return HttpResponseServerError() - - return view_func(request, *args, **kwargs) - - _view.__name__ = view_func.__name__ - _view.__dict__ = view_func.__dict__ - _view.__doc__ = view_func.__doc__ - - return _view - - if function is None: - return _dec - else: - return _dec(function) - + def permission(perm): def _dec(view_func): def _view(request, *args, **kwargs): @@ -80,4 +59,22 @@ def queue(request): return JsonResponse(settings.PYLOAD.get_queue()) except: - return HttpResponseServerError()
\ No newline at end of file + return HttpResponseServerError() + + +@permission('pyload.can_change_satus') +def pause(request): + try: + return JsonResponse(settings.PYLOAD.pause_server()) + + except: + return HttpResponseServerError() + + +@permission('pyload.can_change_status') +def unpause(request): + try: + return JsonResponse(settings.PYLOAD.unpause_server()) + + except: + return HttpResponseServerError() |