Mercurial > python-cmd2
comparison cmd2.py @ 251:bc6dec08275f 0.5.1
transcript tests work
author | catherine@Elli.myhome.westell.com |
---|---|
date | Mon, 30 Mar 2009 14:33:11 -0400 |
parents | ff541573fb5b |
children | 24289178b367 |
comparison
equal
deleted
inserted
replaced
250:ff541573fb5b | 251:bc6dec08275f |
---|---|
633 try: | 633 try: |
634 # "heart" of the command, replace's cmd's onecmd() | 634 # "heart" of the command, replace's cmd's onecmd() |
635 self.lastcmd = statement.parsed.expanded | 635 self.lastcmd = statement.parsed.expanded |
636 funcname = self.func_named(statement.parsed.command) | 636 funcname = self.func_named(statement.parsed.command) |
637 if not funcname: | 637 if not funcname: |
638 return self.postparsing_postcmd(self.default(statement)) | 638 return self.postparsing_postcmd(self.default(statement)) |
639 try: | |
640 func = getattr(self, funcname) | |
641 except AttributeError: | |
642 return self.postparsing_postcmd(self.default(statement)) | |
639 timestart = datetime.datetime.now() | 643 timestart = datetime.datetime.now() |
640 stop = getattr(self, funcname)(statement) | 644 stop = func(statement) |
641 if self.timing: | 645 if self.timing: |
642 print 'Elapsed: %s' % str(datetime.datetime.now() - timestart) | 646 print 'Elapsed: %s' % str(datetime.datetime.now() - timestart) |
643 except Exception, e: | 647 except Exception, e: |
644 print e | 648 print e |
645 finally: | 649 finally: |