comparison cmd2.py @ 232:c8b8477ca549

debugging default
author catherine@dellzilla
date Mon, 23 Mar 2009 17:08:18 -0400
parents 18bf83a77e0e
children d2cc9a090b7f
comparison
equal deleted inserted replaced
231:18bf83a77e0e 232:c8b8477ca549
592 try: 592 try:
593 func = getattr(self, 'do_' + statement.parsed.command) 593 func = getattr(self, 'do_' + statement.parsed.command)
594 except AttributeError: 594 except AttributeError:
595 func = None 595 func = None
596 if self.abbrev: # accept shortened versions of commands 596 if self.abbrev: # accept shortened versions of commands
597 funcs = [func for (fname, func) in inspect.getmembers( 597 funcs = [f for (fname, function) in inspect.getmembers(self, inspect.ismethod)
598 self, inspect.ismethod)
599 if fname.startswith('do_' + statement.parsed.command)] 598 if fname.startswith('do_' + statement.parsed.command)]
600 if len(funcs) == 1: 599 if len(funcs) == 1:
601 func = funcs[0] 600 func = funcs[0]
602 if not func: 601 if not func:
603 return self.postparsing_postcmd(self.default(statement)) 602 return self.postparsing_postcmd(self.default(statement))