Author: andar

Revision: 6074

Log:
        Fix #1116 not being able to use command aliases when not connected to a 
daemon

Diff:
Modified: branches/1.2_RC/ChangeLog
===================================================================
--- branches/1.2_RC/ChangeLog   2010-01-02 23:25:45 UTC (rev 6073)
+++ branches/1.2_RC/ChangeLog   2010-01-03 01:37:57 UTC (rev 6074)
@@ -14,6 +14,7 @@
 
 ==== Console ====
        * Fix #1115 not showing usage for the 'debug' command
+       * Fix #1116 not being able to use command aliases when not connected to 
a daemon
 
 ==== Windows ====
        * Fix displaying folders in the add torrent dialog

Modified: branches/1.2_RC/deluge/ui/console/main.py
===================================================================
--- branches/1.2_RC/deluge/ui/console/main.py   2010-01-02 23:25:45 UTC (rev 
6073)
+++ branches/1.2_RC/deluge/ui/console/main.py   2010-01-03 01:37:57 UTC (rev 
6074)
@@ -295,7 +295,14 @@
                 parser._print_help(f)
         parser.print_help = print_help
 
-        if not client.connected() and cmd not in ("help", "connect", "quit"):
+        # Only these commands can be run when not connected to a daemon
+        not_connected_cmds = ["help", "connect", "quit"]
+        aliases = []
+        for c in not_connected_cmds:
+            aliases.extend(self._commands[c].aliases)
+        not_connected_cmds.extend(aliases)
+
+        if not client.connected() and cmd not in not_connected_cmds:
             self.write("{!error!}Not connected to a daemon, please use the 
connect command first.")
             return
 

Modified: trunk/deluge/ui/console/main.py
===================================================================
--- trunk/deluge/ui/console/main.py     2010-01-02 23:25:45 UTC (rev 6073)
+++ trunk/deluge/ui/console/main.py     2010-01-03 01:37:57 UTC (rev 6074)
@@ -295,7 +295,14 @@
                 parser._print_help(f)
         parser.print_help = print_help
 
-        if not client.connected() and cmd not in ("help", "connect", "quit"):
+        # Only these commands can be run when not connected to a daemon
+        not_connected_cmds = ["help", "connect", "quit"]
+        aliases = []
+        for c in not_connected_cmds:
+            aliases.extend(self._commands[c].aliases)
+        not_connected_cmds.extend(aliases)
+
+        if not client.connected() and cmd not in not_connected_cmds:
             self.write("{!error!}Not connected to a daemon, please use the 
connect command first.")
             return
 


--

You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.


Reply via email to