VirtualMailManager/cli/handler.py
branchv0.6.x
changeset 337 150ddcc8b315
parent 320 011066435e6f
child 339 abff2de9eed0
--- a/VirtualMailManager/cli/handler.py	Tue Aug 03 23:33:46 2010 +0000
+++ b/VirtualMailManager/cli/handler.py	Wed Aug 04 18:41:46 2010 +0000
@@ -14,7 +14,7 @@
 from VirtualMailManager.handler import Handler
 from VirtualMailManager.cli import read_pass
 from VirtualMailManager.cli.config import CliConfig as Cfg
-from VirtualMailManager.constants import INVALID_SECTION
+from VirtualMailManager.constants import ACCOUNT_EXISTS, INVALID_SECTION
 
 _ = lambda msg: msg
 
@@ -68,11 +68,17 @@
                            INVALID_SECTION)
 
     def user_add(self, emailaddress, password=None):
-        """Prefix the parent user_add() with the interactive password
+        """Override the parent user_add() - add the interactive password
         dialog."""
+        acc = self._get_account(emailaddress)
+        if acc:
+            raise VMMError(_(u"The account '%s' already exists.") %
+                           acc.address, ACCOUNT_EXISTS)
         if password is None:
             password = read_pass()
-        super(CliHandler, self).user_add(emailaddress, password)
+        acc.set_password(password)
+        acc.save()
+        self._make_account_dirs(acc)
 
     def user_password(self, emailaddress, password=None):
         """Prefix the parent user_password() with the interactive password