summaryrefslogtreecommitdiffstats
path: root/module/web/pyload
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-08-11 12:01:55 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-08-11 12:01:55 +0200
commit69eb9e649428b930448f496a7a39a9f12bb278bb (patch)
tree83fc72a5df42c3f384fa06ec19e1554ebf18183a /module/web/pyload
parentpackage finished event (diff)
downloadpyload-69eb9e649428b930448f496a7a39a9f12bb278bb.tar.xz
correct order in webif
Diffstat (limited to 'module/web/pyload')
-rw-r--r--module/web/pyload/views.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py
index 2d210b6d7..8cdef094b 100644
--- a/module/web/pyload/views.py
+++ b/module/web/pyload/views.py
@@ -10,6 +10,7 @@ from os.path import join
from urllib import unquote
from itertools import chain
from datetime import datetime
+from operator import itemgetter
from django.conf import settings
from django.contrib.auth.decorators import login_required
@@ -19,6 +20,10 @@ from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.translation import ugettext as _
+
+def get_sort_key(item):
+ return item[1]["order"]
+
def check_server(function):
def _dec(view_func):
def _view(request, * args, ** kwargs):
@@ -99,8 +104,18 @@ def queue(request):
pyfile["icon"] = "status_proc.png"
else:
pyfile["icon"] = "status_downloading.png"
+
+
+ #@TODO: replace lambdas
+ data = zip(queue.keys(), queue.values())
+ data.sort(key=get_sort_key)
+
+ for id, value in data:
+ tmp = zip(value["links"].keys(), value["links"].values())
+ tmp.sort(key=get_sort_key)
+ value["links"] = tmp
- return render_to_response(join(settings.TEMPLATE, 'queue.html'), RequestContext(request, {'content': queue}, [status_proc]))
+ return render_to_response(join(settings.TEMPLATE, 'queue.html'), RequestContext(request, {'content': data}, [status_proc]))
@login_required
@@ -267,8 +282,17 @@ def collector(request):
pyfile["icon"] = "status_proc.png"
else:
pyfile["icon"] = "status_downloading.png"
+
+ #@TODO: replace lambdas
+ data = zip(queue.keys(), queue.values())
+ data.sort(key=get_sort_key)
- return render_to_response(join(settings.TEMPLATE, 'collector.html'), RequestContext(request, {'content': queue}, [status_proc]))
+ for id, value in data:
+ tmp = zip(value["links"].keys(), value["links"].values())
+ tmp.sort(key=get_sort_key)
+ value["links"] = tmp
+
+ return render_to_response(join(settings.TEMPLATE, 'collector.html'), RequestContext(request, {'content': data}, [status_proc]))
@login_required