Author: damoxc

Revision: 5920

Log:
        allow commands that are .pyc files to be used

Diff:
Modified: branches/1.2_RC/ChangeLog
===================================================================
--- branches/1.2_RC/ChangeLog   2009-11-04 23:36:27 UTC (rev 5919)
+++ branches/1.2_RC/ChangeLog   2009-11-04 23:49:07 UTC (rev 5920)
@@ -11,6 +11,7 @@
        * Escape hyphens in the manpage
        * Make the delete key work
        * Allow ~ to be used in the path in the add command
+       * Allow commands that are .pyc files to be used
 
 === Deluge 1.2.0_rc3 (01 November 2009) ===
 ==== Core ====

Modified: branches/1.2_RC/deluge/ui/console/main.py
===================================================================
--- branches/1.2_RC/deluge/ui/console/main.py   2009-11-04 23:36:27 UTC (rev 
5919)
+++ branches/1.2_RC/deluge/ui/console/main.py   2009-11-04 23:49:07 UTC (rev 
5920)
@@ -124,10 +124,12 @@
     try:
         commands = []
         for filename in os.listdir(command_dir):
-            if filename.split('.')[0] in exclude or filename.startswith('_') 
or not filename.endswith('.py'):
+            if filename.split('.')[0] in exclude or filename.startswith('_'):
                 continue
-            cmd = get_command(filename[:-3])
-            aliases = [ filename[:-3] ]
+            if not (filename.endswith('.py') or filename.endswith('.pyc')):
+                continue
+            cmd = get_command(filename.split('.')[len(filename.split('.')) - 
2])
+            aliases = [ filename.split('.')[len(filename.split('.')) - 2] ]
             aliases.extend(cmd.aliases)
             for a in aliases:
                 commands.append((a, cmd))

Modified: trunk/deluge/ui/console/main.py
===================================================================
--- trunk/deluge/ui/console/main.py     2009-11-04 23:36:27 UTC (rev 5919)
+++ trunk/deluge/ui/console/main.py     2009-11-04 23:49:07 UTC (rev 5920)
@@ -124,10 +124,12 @@
     try:
         commands = []
         for filename in os.listdir(command_dir):
-            if filename.split('.')[0] in exclude or filename.startswith('_') 
or not filename.endswith('.py'):
+            if filename.split('.')[0] in exclude or filename.startswith('_'):
                 continue
-            cmd = get_command(filename[:-3])
-            aliases = [ filename[:-3] ]
+            if not (filename.endswith('.py') or filename.endswith('.pyc')):
+                continue
+            cmd = get_command(filename.split('.')[len(filename.split('.')) - 
2])
+            aliases = [ filename.split('.')[len(filename.split('.')) - 2] ]
             aliases.extend(cmd.aliases)
             for a in aliases:
                 commands.append((a, cmd))



--~--~---------~--~----~------------~-------~--~----~
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