diff --git a/modoboa/admin/management/commands/handle_mailbox_operations.py b/modoboa/admin/management/commands/handle_mailbox_operations.py index b6332d9ac..e4da2cb36 100644 --- a/modoboa/admin/management/commands/handle_mailbox_operations.py +++ b/modoboa/admin/management/commands/handle_mailbox_operations.py @@ -25,10 +25,11 @@ class Command(BaseCommand): if not os.path.exists(operation.argument): return new_mail_home = operation.mailbox.mail_home - try: - os.makedirs(os.path.dirname(new_mail_home)) - except os.error as e: - raise OperationError(str(e)) + if not os.path.exists(new_mail_home): + try: + os.makedirs(os.path.dirname(new_mail_home)) + except os.error as e: + raise OperationError(str(e)) code, output = exec_cmd( "mv %s %s" % (ope.argument, new_mail_home) ) @@ -56,7 +57,7 @@ class Command(BaseCommand): try: f(ope) except (OperationError, AdminError) as e: - self.logger.critical('Operation failed: %s. Reason: %s', ope, str(e)) + self.logger.critical('%s failed (reason: %s)', ope, e) else: - self.logger.info('Operation succeed: %s', ope) + self.logger.info('%s succeed', ope) ope.delete() diff --git a/modoboa/admin/models.py b/modoboa/admin/models.py index 5b6a111ef..2e2084857 100644 --- a/modoboa/admin/models.py +++ b/modoboa/admin/models.py @@ -1028,7 +1028,7 @@ class MailboxOperation(models.Model): def __str__(self): if self.type == 'rename': - return 'Rename %s -> %s' % (self.argument, self.mailbox.full_address) + return 'Rename %s -> %s' % (self.argument, self.mailbox.mail_home) return 'Delete %s' % self.argument