changeset 214:68c03076c9e7

multiple connections
author catherine@Elli.myhome.westell.com
date Mon, 16 Mar 2009 02:46:57 -0400
parents 500955dece3f
children e9091d9a3a60
files cmd2.py
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/cmd2.py	Sat Mar 14 20:05:15 2009 -0400
+++ b/cmd2.py	Mon Mar 16 02:46:57 2009 -0400
@@ -81,13 +81,17 @@
                 return
             if hasattr(opts, '_exit'):
                 return None
-            terminator = arg.parsed.terminator
-            try:
-                if arg.parsed.terminator[0] == '\n':
-                    terminator = arg.parsed.terminator[0]
-            except IndexError:
-                pass
-            arg = arg.parser('%s %s%s%s' % (arg.parsed.command, newArgs, terminator, arg.parsed.suffix))
+            if hasattr(arg, 'parser'):
+                terminator = arg.parsed.terminator
+                try:
+                    if arg.parsed.terminator[0] == '\n':
+                        terminator = arg.parsed.terminator[0]
+                except IndexError:
+                    pass
+                arg = arg.parser('%s %s%s%s' % (arg.parsed.command, newArgs, 
+                                                terminator, arg.parsed.suffix))
+            else:
+                arg = newArgs
             result = func(instance, arg, opts)                            
             return result        
         newFunc.__doc__ = '%s\n%s' % (func.__doc__, optionParser.format_help())