diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-12-16 22:49:48 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-12-16 22:49:48 +0100 |
commit | ea5dbe7e25b156bb0b2e9e6da06c7da9549ddbe5 (patch) | |
tree | df4f212d5d320700dc8db4509fc9326e385d0899 /module/web/ajax | |
parent | Fixed Relink.us, Uploaded.to Name Bug (diff) | |
parent | Webinterface authsystem (diff) | |
download | pyload-ea5dbe7e25b156bb0b2e9e6da06c7da9549ddbe5.tar.xz |
merged
Diffstat (limited to 'module/web/ajax')
-rw-r--r-- | module/web/ajax/views.py | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/module/web/ajax/views.py b/module/web/ajax/views.py index d883376e7..c4395a659 100644 --- a/module/web/ajax/views.py +++ b/module/web/ajax/views.py @@ -12,9 +12,10 @@ def check_server(function): def _view(request, *args, **kwargs): try: version = settings.PYLOAD.get_server_version() - return view_func(request, *args, **kwargs) except Exception, e: return HttpResponseServerError() + + return view_func(request, *args, **kwargs) _view.__name__ = view_func.__name__ _view.__dict__ = view_func.__dict__ @@ -30,7 +31,7 @@ def check_server(function): def permission(perm): def _dec(view_func): def _view(request, *args, **kwargs): - if request.user.has_perm(perm) and request.user.is_authenticated: + if request.user.has_perm(perm) and request.user.is_authenticated(): return view_func(request, *args, **kwargs) else: return HttpResponseForbidden() @@ -57,14 +58,26 @@ class JsonResponse(HttpResponse): def add_package(request): a = {'b' : [1,2,3], 'dsfsd' : "sadd"} return JsonResponse(a) - -# @TODO: Auth + Auth - + + +@permission('pyload.can_see_dl') def status(request): - return JsonResponse(settings.PYLOAD.status_server()) - + try: + return JsonResponse(settings.PYLOAD.status_server()) + except: + return HttpResponseServerError() + +@permission('pyload.can_see_dl') def links(request): - return JsonResponse(settings.PYLOAD.status_downloads()) - + try: + return JsonResponse(settings.PYLOAD.status_downloads()) + except: + return HttpResponseServerError() + +@permission('pyload.can_see_dl') def queue(request): - return JsonResponse(settings.PYLOAD.get_queue())
\ No newline at end of file + try: + return JsonResponse(settings.PYLOAD.get_queue()) + + except: + return HttpResponseServerError()
\ No newline at end of file |