comparison cmd2.py @ 48:34fb41095451

avoiding do_load overload
author catherine.devlin@gmail.com
date Tue, 03 Jun 2008 15:26:54 -0400
parents 927bc07467de
children 8926b72d828e
comparison
equal deleted inserted replaced
47:927bc07467de 48:34fb41095451
488 f = open(filename, 'w') 488 f = open(filename, 'w')
489 f.write(buffer or '') 489 f.write(buffer or '')
490 f.close() 490 f.close()
491 491
492 os.system('%s %s' % (self.editor, filename)) 492 os.system('%s %s' % (self.editor, filename))
493 self.do_load(filename) 493 self.do__load(filename)
494 do_edit = do_ed 494 do_edit = do_ed
495 495
496 def do_save(self, fname=None): 496 def do_save(self, fname=None):
497 """Saves most recent command to a file.""" 497 """Saves most recent command to a file."""
498 498
526 self.prompt = self.continuationPrompt = '' 526 self.prompt = self.continuationPrompt = ''
527 stop = self.cmdloop() 527 stop = self.cmdloop()
528 self.stdin.close() 528 self.stdin.close()
529 keepstate.restore() 529 keepstate.restore()
530 self.lastcmd = '' 530 self.lastcmd = ''
531 return (stop == self._STOP_AND_EXIT) and self._STOP_AND_EXIT 531 return (stop == self._STOP_AND_EXIT) and self._STOP_AND_EXIT
532 do__load = do_load # avoid an unfortunate legacy use of do_load from sqlpython
532 533
533 def do_run(self, arg): 534 def do_run(self, arg):
534 """run [arg]: re-runs an earlier command 535 """run [arg]: re-runs an earlier command
535 536
536 no arg -> run most recent command 537 no arg -> run most recent command