Allow username to take no argument to erase value
Once a username has been set, it could not be removed via the UI. Now, if no
argument is passed to username, the value stored is replaced with NULL.
--- a/VirtualMailManager/cli/subcommands.py Sat Apr 14 12:39:06 2012 +0200
+++ b/VirtualMailManager/cli/subcommands.py Sat Apr 14 14:33:21 2012 +0200
@@ -593,9 +593,11 @@
if ctx.argc < 3:
usage(EX_MISSING_ARGS, _(u"Missing e-mail address and user's name."),
ctx.scmd)
- if ctx.argc < 4:
- usage(EX_MISSING_ARGS, _(u"Missing user's name."), ctx.scmd)
- ctx.hdlr.user_name(ctx.args[2].lower(), ctx.args[3])
+ elif ctx.argc < 4:
+ name = None
+ else:
+ name = ctx.args[3]
+ ctx.hdlr.user_name(ctx.args[2].lower(), name)
def user_password(ctx):
--- a/VirtualMailManager/handler.py Sat Apr 14 12:39:06 2012 +0200
+++ b/VirtualMailManager/handler.py Sat Apr 14 14:33:21 2012 +0200
@@ -752,9 +752,6 @@
def user_name(self, emailaddress, name):
"""Wrapper for Account.modify('name', ...)."""
- if not isinstance(name, basestring) or not name:
- raise VMMError(_(u"Could not accept name: '%s'") % name,
- INVALID_ARGUMENT)
acc = self._get_account(emailaddress)
if not acc:
raise VMMError(_(u"The account '%s' does not exist.") %
--- a/man/de/man1/vmm.1 Sat Apr 14 12:39:06 2012 +0200
+++ b/man/de/man1/vmm.1 Sat Apr 14 14:33:21 2012 +0200
@@ -693,9 +693,13 @@
.SS username (un)
.BI "vmm username" " address name"
.PP
-Der Bürgerliche Name des Kontoinhabers mit der angegebenen Adresse kann mit
+Der bürgerliche Name des Kontoinhabers mit der angegebenen Adresse kann mit
diesem Unterbefehl gesetzt/aktualisiert werden.
.PP
+Wird kein
+.I name
+übergeben, so wird der Wert in den Kontoinformationen gelöscht.
+.PP
Beispiel:
.PP
.nf
--- a/man/man1/vmm.1 Sat Apr 14 12:39:06 2012 +0200
+++ b/man/man1/vmm.1 Sat Apr 14 14:33:21 2012 +0200
@@ -663,6 +663,10 @@
.I name
can be set/updated with this subcommand.
.PP
+If no
+.I name
+is given, the value stored for the account is erased.
+.PP
Example:
.PP
.nf