Opened 9 years ago

Closed 7 years ago

#755 closed bug (Fixed)

Can't set listen_ports through console UI

Reported by: florian@… Owned by: Cas
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 Changed 9 years ago by anonymous

  • Milestone 1.1.1 deleted

Milestone 1.1.1 deleted

comment:2 Changed 8 years ago by andar

  • Resolution set to fixed
  • Status changed from new to closed

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 Changed 8 years ago by andar

>>> 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 Changed 7 years ago by sneak

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from 1.1.0 to 1.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 Changed 7 years ago by Sian

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 Changed 7 years ago by Cas

  • Component changed from other to console
  • Milestone set to 1.3.2
  • Priority changed from major to minor

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 Changed 7 years ago by Cas

  • Owner changed from andar to Cas
  • Status changed from reopened to accepted

comment:8 Changed 7 years ago by Cas

  • Resolution set to fixed
  • Status changed from accepted to closed

1.3-stable: b9ff47e10f

Note: See TracTickets for help on using tickets.