From 396b2ab5e79be869f66fad3833f107e54f6fa3ef Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 19 Jul 2009 15:39:26 -0400 Subject: Adjusted final commit-handling in be-handle-mail. Now the final commit will run whether or not the preceding commands raise any exceptions. Note that since we've added the "--allow-empty" to "be commit", we don't need to worry about empty commits after read-only actions. --- interfaces/email/interactive/be-handle-mail | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'interfaces/email/interactive/be-handle-mail') diff --git a/interfaces/email/interactive/be-handle-mail b/interfaces/email/interactive/be-handle-mail index e5f9dcf..e532b1d 100755 --- a/interfaces/email/interactive/be-handle-mail +++ b/interfaces/email/interactive/be-handle-mail @@ -387,11 +387,11 @@ class Message (object): otherwise returns a list of suggested commands to run. """ self.validate_subject() - tag,subject = self._split_subject() tag_type,value = self._subject_tag_type() commands = [] if tag_type == u"new": command = u"new" + tag,subject = self._split_subject() summary = subject options = {u"Reporter": self.author_addr()} body,mime_type = list(self._get_bodies_and_mime_types())[0] @@ -440,17 +440,18 @@ class Message (object): raise InvalidEmail(self, u"No commands in control email.") else: raise Exception, u"Unrecognized tag type '%s'" % tag_type - if AUTOCOMMIT == True: - commands.append(Command(self, "commit", [subject])) return commands def run(self): self._begin_response() commands = self.parse() - if LOGFILE != None: - LOGFILE.write("Running:\n %s\n\n" % "\n ".join([str(c) for c in commands])) - for command in commands: - command.run() - self._add_response(command.response_msg()) + try: + for command in commands: + command.run() + self._add_response(command.response_msg()) + finally: + if AUTOCOMMIT == True: + tag,subject = self._split_subject() + command = Command(self, "commit", [self.subject]) def _begin_response(self): tag,subject = self._split_subject() response_header = [u"From: %s" % HANDLER_ADDRESS, -- cgit