Opened 16 years ago

Closed 14 years ago

#755 closed bug (Fixed)

Can't set listen_ports through console UI

Reported by: florian@wagner-flo.net Owned by: Calum
Priority: minor Milestone: 1.3.2
Component: Console UI Version: 1.3.1
Keywords: Cc:

Description

>>> config
...
 * listen_ports: [6881, 6891]
...

This suggests the following to work, which it doesn't.

>>> config -s listen_ports [10000, 10010]
 * malformed expression ([)

Trying a tuple instead of a list is also a no-go.

>>> config -s listen_ports (10000, 10000)
 * Configuration value provided has incorrect type.

Neither does leaving the comma and/or parentheses off.

>>> config -s listen_ports 10000, 10010
 * bogus data after expression
>>> config -s listen_ports 10000 10010
 * bogus data after expression
>>> config -s listen_ports (10000 10010)
 * Configuration value provided has incorrect type.

Change History (8)

comment:1 by (none), 16 years ago

Milestone: 1.1.1

Milestone 1.1.1 deleted

comment:2 by andar, 15 years ago

Resolution: fixed
Status: newclosed

This is fixed in 1.2.

{{

config listen_ports

listen_ports: (6881, 6891)

config -s listen_ports (10000,10010)

Configuration value successfully updated.

  • ConfigValueChanged: listen_ports: (10000, 10010)

    config listen_ports

    listen_ports: (10000, 10010)

}}

comment:3 by andar, 15 years ago

>>> config listen_ports
  listen_ports: (6881, 6891)
>>> config -s listen_ports [10000,10010]
malformed expression ([)
>>> config -s listen_ports (10000,10010)
Configuration value successfully updated.
* ConfigValueChanged: listen_ports: (10000, 10010)
>>> config listen_ports
  listen_ports: (10000, 10010)

comment:4 by sneak, 14 years ago

Resolution: fixed
Status: closedreopened
Version: 1.1.01.3.1

This seems to be back in 1.3.1:

>>> config -s listen_ports (10111, 10222)                                                                                                                                                                                                                                         
could not convert string to float: (10111, 10222)
Traceback (most recent call last):

  File "/usr/local/lib/python2.7/site-packages/deluge-1.3.1-py2.7-linux-i686.egg/deluge/ui/console/main.py", line 320, in do_command
    ret = self._commands[cmd].handle(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/site-packages/deluge-1.3.1-py2.7-linux-i686.egg/deluge/ui/console/commands/config.py", line 98, in handle
    return self._set_config(*args, **options)
File "/usr/local/lib/python2.7/site-packages/deluge-1.3.1-py2.7-linux-i686.egg/deluge/ui/console/commands/config.py", line 134, in _set_config
    val = simple_eval(options["set"][1] + " " + " ".join(args))
  File "/usr/local/lib/python2.7/site-packages/deluge-1.3.1-py2.7-linux-i686.egg/deluge/ui/console/commands/config.py", line 81, in simple_eval
    res = atom(src.next, src.next())
  File "/usr/local/lib/python2.7/site-packages/deluge-1.3.1-py2.7-linux-i686.egg/deluge/ui/console/commands/config.py", line 56, in atom
    out.append(atom(next, token))                                                                                                                                                                                                                                                 
  File "/usr/local/lib/python2.7/site-packages/deluge-1.3.1-py2.7-linux-i686.egg/deluge/ui/console/commands/config.py", line 65, in atom
    return float(token[-1])
ValueError: could not convert string to float: (10111, 10222)

comment:5 by Sian, 14 years ago

Well,

this could probably be resolved by changing line 65 in config.py from float type conversion:

return float(token[-1])

to some other conversion. I had a similar problem and after switching to a string type conversion

return str(token[-1])

it worked.

comment:6 by Calum, 14 years ago

Component: otherconsole
Milestone: 1.3.2
Priority: majorminor

I think that the issue was caused by line 69 being changed between 1.2.3 to 1.3

I looked into this a while ago and found this was the change to revert.

-        return token[-1].decode("string-escape")
+        return token[1][1:-1].decode("string-escape")

I am putting this here simply for reference as I found that Sian's suggested fix also works.

comment:7 by Calum, 14 years ago

Owner: changed from andar to Calum
Status: reopenedaccepted

comment:8 by Calum, 14 years ago

Resolution: fixed
Status: acceptedclosed

1.3-stable: b9ff47e10f

Note: See TracTickets for help on using tickets.