diff --git a/deluge/ui/webui/webui_plugin/config.py b/deluge/ui/webui/webui_plugin/config.py
index b590e9b25..737fe5b7f 100644
--- a/deluge/ui/webui/webui_plugin/config.py
+++ b/deluge/ui/webui/webui_plugin/config.py
@@ -1,8 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# deluge_webserver.py
-#
# Copyright (C) Martijn Voncken 2008
#
# This program is free software; you can redistribute it and/or modify
diff --git a/deluge/ui/webui/webui_plugin/lib/newforms_plus.py b/deluge/ui/webui/webui_plugin/lib/newforms_plus.py
index e11c56b4d..e093e5c20 100644
--- a/deluge/ui/webui/webui_plugin/lib/newforms_plus.py
+++ b/deluge/ui/webui/webui_plugin/lib/newforms_plus.py
@@ -58,9 +58,9 @@ class FilteredForm(newforms.Form):
output.append(str_hidden)
return u'\n'.join(output)
- def as_table(self , filter = None):
+ def as_table(self , filter = None): #add class="newforms"
"Returns this form rendered as HTML s -- excluding the ."
- return self._html_output_filtered(u'
%(label)s | %(errors)s%(field)s%(help_text)s |
', u'%s |
', '', u'
%s', False, filter)
+ return self._html_output_filtered(u'%(label)s | %(errors)s%(field)s%(help_text)s |
', u'%s |
', '', u'
%s', False, filter)
def as_ul(self, filter = None):
"Returns this form rendered as HTML s -- excluding the ."
@@ -70,7 +70,7 @@ class FilteredForm(newforms.Form):
"Returns this form rendered as HTML s."
return self._html_output_filtered(u'
%(label)s %(field)s%(help_text)s
', u'%s
', '
', u' %s', True, filter)
-class Form(newforms.Form):
+class Form(FilteredForm):
info = ""
title = "No Title"
def __init__(self,data = None):
diff --git a/deluge/ui/webui/webui_plugin/pages.py b/deluge/ui/webui/webui_plugin/pages.py
index 8ed068048..f31aff872 100644
--- a/deluge/ui/webui/webui_plugin/pages.py
+++ b/deluge/ui/webui/webui_plugin/pages.py
@@ -54,6 +54,9 @@ import os
from json_api import json_api
+#special/complex pages:
+from torrent_add import torrent_add
+
#routing:
urls = (
"/login", "login",
@@ -176,41 +179,6 @@ class torrent_reannounce:
ws.proxy.force_reannounce([torrent_id])
do_redirect()
-class torrent_add:
- @deco.deluge_page
- def GET(self, name):
- return render.torrent_add()
-
- @deco.check_session
- def POST(self, name):
- """
- allows:
- *posting of url
- *posting file-upload
- *posting of data as string(for greasemonkey-private)
- """
-
- vars = web.input(url = None, torrent = {})
-
- torrent_name = None
- torrent_data = None
- if vars.torrent.filename:
- torrent_name = vars.torrent.filename
- torrent_data = vars.torrent.file.read()
-
- if vars.url and torrent_name:
- error_page(_("Choose an url or a torrent, not both."))
- if vars.url:
- ws.proxy.add_torrent_url(vars.url)
- do_redirect()
- elif torrent_name:
- data_b64 = base64.b64encode(torrent_data)
- #b64 because of strange bug-reports related to binary data
- ws.proxy.add_torrent_filecontent(vars.torrent.filename, data_b64)
- do_redirect()
- else:
- error_page(_("no data."))
-
class remote_torrent_add:
"""
For use in remote scripts etc.
diff --git a/deluge/ui/webui/webui_plugin/render.py b/deluge/ui/webui/webui_plugin/render.py
index dbcf5ca1b..b304ae4c3 100644
--- a/deluge/ui/webui/webui_plugin/render.py
+++ b/deluge/ui/webui/webui_plugin/render.py
@@ -48,6 +48,9 @@ class subclassed_render(object):
self.apply_cfg()
def apply_cfg(self):
+ if not hasattr(ws,"config"):
+ print "render.py: WARNING,no config"
+ return
cache = ws.config.get('cache_templates')
self.base_template = template.render(
os.path.join(ws.webui_path, 'templates/deluge/'),
@@ -79,8 +82,11 @@ def category_tabs(torrent_list):
def template_crop(text, end):
- if len(text) > end:
- return text[0:end - 3] + '...'
+ try:
+ if len(text) > end:
+ return text[0:end - 3] + '...'
+ except:
+ return "[ERROR NOT A STRING:(%s)]" % text
return text
def template_sort_head(id,name):
diff --git a/deluge/ui/webui/webui_plugin/templates/advanced/static/advanced.css b/deluge/ui/webui/webui_plugin/templates/advanced/static/advanced.css
index b8135c2d8..7dc2777dc 100644
--- a/deluge/ui/webui/webui_plugin/templates/advanced/static/advanced.css
+++ b/deluge/ui/webui/webui_plugin/templates/advanced/static/advanced.css
@@ -318,6 +318,12 @@ ul.errorlist {
#torrent_list {
-moz-border-radius:7px;
}
+
+th.newforms {
+ font-size: 12px;
+ text-align:right;
+ color:#FFFFFF;
+}
/* Hides from IE-mac \*/
* html .clearfix {height: 1%;}
.clearfix {display: block;}
/* End hide from IE-mac */
diff --git a/deluge/ui/webui/webui_plugin/templates/deluge/torrent_add.html b/deluge/ui/webui/webui_plugin/templates/deluge/torrent_add.html
index 490f300bf..067845ac5 100644
--- a/deluge/ui/webui/webui_plugin/templates/deluge/torrent_add.html
+++ b/deluge/ui/webui/webui_plugin/templates/deluge/torrent_add.html
@@ -1,3 +1,4 @@
+$def with (add_form)
$:render.header(_("Add Torrent"))
diff --git a/deluge/ui/webui/webui_plugin/tests/multicall_notepad.py b/deluge/ui/webui/webui_plugin/tests/multicall_notepad.py
index 501f48c45..62bf7a1ff 100644
--- a/deluge/ui/webui/webui_plugin/tests/multicall_notepad.py
+++ b/deluge/ui/webui/webui_plugin/tests/multicall_notepad.py
@@ -68,14 +68,14 @@ start = time.time()
torrent_ids = ws.proxy.get_session_state() #Syc-api.
torrent_dict = {}
for id in torrent_ids:
- async_proxy.get_torrent_status(dict_cb(id,torrent_dict), id, [])
+ async_proxy.get_torrent_status(dict_cb(id,torrent_dict), id, ["name"])
async_proxy.force_call(block=True)
print "Async-list:",time.time() - start
-print torrent_dict
-
-
-print sorted(torrent_list[0].keys())
+print torrent_dict[torrent_ids[0]].keys()
+print torrent_dict[torrent_ids[0]]["name"]
+
+
diff --git a/deluge/ui/webui/webui_plugin/utils.py b/deluge/ui/webui/webui_plugin/utils.py
index 2ebdb708f..4a9986302 100644
--- a/deluge/ui/webui/webui_plugin/utils.py
+++ b/deluge/ui/webui/webui_plugin/utils.py
@@ -237,16 +237,12 @@ def get_torrent_list():
torrent_ids = ws.proxy.get_session_state() #Syc-api.
torrent_dict = {}
for id in torrent_ids:
- ws.async_proxy.get_torrent_status(dict_cb(id,torrent_dict), id, [])
+ ws.async_proxy.get_torrent_status(dict_cb(id,torrent_dict), id,
+ TORRENT_KEYS)
ws.async_proxy.force_call(block=True)
-
return [enhance_torrent_status(id, status)
for id, status in torrent_dict.iteritems()]
-
-
-
-
def get_categories(torrent_list):
trackers = [(torrent['category'] or 'unknown') for torrent in torrent_list]
categories = {}