torrent_add options bugfix

This commit is contained in:
Martijn Voncken 2008-02-12 18:39:07 +00:00
parent 0b306717b6
commit 345f61b740
4 changed files with 10 additions and 8 deletions

View File

@ -91,7 +91,7 @@ class config_page:
@deco.deluge_page
def POST(self,name):
form_data = utils.get_newforms_data(form_class)
form_data = web.Storage(utils.get_newforms_data(form_class))
form = form_class(form_data)
if form.is_valid():
ws.log.debug('save config %s' % form_data)

View File

@ -89,12 +89,13 @@ class torrent_add:
*posting of data as string(for greasemonkey-private)
"""
options = dict(utils.get_newforms_data(OptionsForm))
options_form = OptionsForm(options)
options_form = OptionsForm(utils.get_newforms_data(OptionsForm))
if not options_form.is_valid():
print self.add_page(error = _("Error in torrent options."))
return
options = options_form.clean_data
vars = web.input(url = None, torrent = {})
torrent_name = None
@ -108,7 +109,7 @@ class torrent_add:
print self.add_page(error = _("Choose an url or a torrent, not both."))
return
if vars.url:
ws.proxy.add_torrent_url(vars.url, options)
ws.proxy.add_torrent_url(vars.url,options)
utils.do_redirect()
elif torrent_name:
data_b64 = base64.b64encode(torrent_data)

View File

@ -224,7 +224,7 @@ def get_torrent_status(torrent_id):
helper method.
enhance ws.proxy.get_torrent_status with some extra data
"""
status = ws.proxy.get_torrent_status(torrent_id,TORRENT_KEYS)
status = ws.proxy.get_torrent_status(torrent_id,[])
return enhance_torrent_status(torrent_id, status)
@ -303,10 +303,11 @@ def get_newforms_data(form_class):
"""
import lib.newforms_plus as forms
fields = form_class.base_fields.keys()
form_data = web.Storage()
form_data = {}
vars = web.input()
for field in fields:
form_data[field] = vars.get(field)
#ws.log.debug("form-field:%s=%s" % (field, form_data[field]))
#DIRTY HACK: (for multiple-select)
if isinstance(form_class.base_fields[field],
forms.MultipleChoiceField):

View File

@ -190,8 +190,8 @@ class Ws:
f = open(filename,"wb")
f.write(base64.b64decode(data_b64))
f.close()
self.proxy.add_torrent_file([filename] , options)
self.log.debug("options:%s" % options)
self.proxy.add_torrent_file([filename] , [options])
self.proxy.add_torrent_filecontent = add_torrent_filecontent
self.log.debug('cfg-file %s' % self.config_file)