# HG changeset patch # User Pascal Volk # Date 1280975900 0 # Node ID abff2de9eed0c72ef1d3abb2c05b62807351fe32 # Parent 45834dcc280e5fba0412440863e8fb8f69c5084f VMM/cli/handler: CliHandler.user_password: Only prompt for the password if the Account exists. diff -r 45834dcc280e -r abff2de9eed0 VirtualMailManager/cli/handler.py --- a/VirtualMailManager/cli/handler.py Thu Aug 05 00:12:52 2010 +0000 +++ b/VirtualMailManager/cli/handler.py Thu Aug 05 02:38:20 2010 +0000 @@ -14,7 +14,8 @@ from VirtualMailManager.handler import Handler from VirtualMailManager.cli import read_pass from VirtualMailManager.cli.config import CliConfig as Cfg -from VirtualMailManager.constants import ACCOUNT_EXISTS, INVALID_SECTION +from VirtualMailManager.constants import ACCOUNT_EXISTS, INVALID_SECTION, \ + NO_SUCH_ACCOUNT _ = lambda msg: msg @@ -81,10 +82,14 @@ self._make_account_dirs(acc) def user_password(self, emailaddress, password=None): - """Prefix the parent user_password() with the interactive password - dialog.""" - if password is None: + """Override the parent user_password() - add the interactive + password dialog.""" + acc = self._get_account(emailaddress) + if not acc: + raise VMMError(_(u"The account '%s' doesn't exist.") % + acc.address, NO_SUCH_ACCOUNT) + if not isinstance(password, basestring) or not password: password = read_pass() - super(CliHandler, self).user_password(emailaddress, password) + acc.modify('password', password) del _