VMM: Unified parameter names and option names.
handler: Handler.user_delete() renamed parameter:
delete_home -> del_dir
The same as in Handler.domain_delete().
cli/subcommands: renamed userdelete's option
--delete-home -> --delete-directory
So people have to memorize only one option name. It also matches the
setting names of vmm.cfg.
--- a/VirtualMailManager/cli/subcommands.py Mon Jun 09 18:12:03 2014 +0000
+++ b/VirtualMailManager/cli/subcommands.py Mon Jun 09 18:47:44 2014 +0000
@@ -349,7 +349,7 @@
def user_delete(ctx):
"""delete the specified user"""
- ctx.hdlr.user_delete(ctx.args.address.lower(), ctx.args.delete_home,
+ ctx.hdlr.user_delete(ctx.args.address.lower(), ctx.args.delete_directory,
ctx.args.force)
@@ -912,17 +912,17 @@
ud = a('userdelete', aliases=('ud',),
help=_('delete the specified user'),
epilog=fill(_('Use this subcommand to delete the account with the '
- 'given address.\n\nWhen the --delete-home option is present, '
- 'vmm will also delete the account\'s home directory. This '
- 'overrides the account.delete_directory setting of vmm.cfg.\n\n'
- 'If there are one or more aliases with an identical '
- 'destination address, vmm will abort the requested operation '
- 'and show an error message. To prevent this, give the optional '
- 'argument --force.')),
+ 'given address.\n\nWhen the --delete-directory option is '
+ 'present, vmm will also delete the account\'s home directory. '
+ 'This overrides the account.delete_directory setting of '
+ 'vmm.cfg.\n\nIf there are one or more aliases with an '
+ 'identical destination address, vmm will abort the requested '
+ 'operation and show an error message. To prevent this, give '
+ 'the optional argument --force.')),
formatter_class=RawDescriptionHelpFormatter)
ud.add_argument('address',
help=_("an account's e-mail address (local-part@fqdn)"))
- ud.add_argument('--delete-home', action='store_true',
+ ud.add_argument('--delete-directory', action='store_true',
help=_("delete the account's home directory"))
ud.add_argument('--force', action='store_true',
help=_('also delete assigned alias addresses'))
--- a/VirtualMailManager/handler.py Mon Jun 09 18:12:03 2014 +0000
+++ b/VirtualMailManager/handler.py Mon Jun 09 18:47:44 2014 +0000
@@ -626,10 +626,10 @@
self._warnings.append(_("The destination account/alias '%s' "
"does not exist.") % destination)
- def user_delete(self, emailaddress, delete_home, force=False):
+ def user_delete(self, emailaddress, del_dir, force=False):
"""Wrapper around Account.delete(...)"""
- if not isinstance(delete_home, bool):
- raise TypeError('delete_home must be a bool')
+ if not isinstance(del_dir, bool):
+ raise TypeError('del_dir must be a bool')
if not isinstance(force, bool):
raise TypeError('force must be a bool')
acc = self._get_account(emailaddress)
@@ -641,7 +641,7 @@
dom_dir = acc.domain.directory
acc_dir = acc.home
acc.delete(force)
- if delete_home or self._cfg.dget('account.delete_directory'):
+ if del_dir or self._cfg.dget('account.delete_directory'):
try:
self._delete_home(dom_dir, uid, gid)
except VMMError as err: