VirtualMailManager/cli/subcommands.py
branchv0.6.x
changeset 565 a75923ce2842
parent 561 b0165b7af7a3
child 568 14abdd04ddf5
equal deleted inserted replaced
564:55148bc6348e 565:a75923ce2842
   671     if ctx.argc < 3:
   671     if ctx.argc < 3:
   672         usage(EX_MISSING_ARGS, _(u'Missing e-mail address and storage value.'),
   672         usage(EX_MISSING_ARGS, _(u'Missing e-mail address and storage value.'),
   673               ctx.scmd)
   673               ctx.scmd)
   674     elif ctx.argc < 4:
   674     elif ctx.argc < 4:
   675         usage(EX_MISSING_ARGS, _(u'Missing storage value.'), ctx.scmd)
   675         usage(EX_MISSING_ARGS, _(u'Missing storage value.'), ctx.scmd)
   676     if ctx.args[3] != 'default':
   676     if ctx.args[3] != 'domain':
   677         try:
   677         try:
   678             bytes_ = size_in_bytes(ctx.args[3])
   678             bytes_ = size_in_bytes(ctx.args[3])
   679         except (ValueError, TypeError):
   679         except (ValueError, TypeError):
   680             usage(INVALID_ARGUMENT, _(u"Invalid storage value: '%s'") %
   680             usage(INVALID_ARGUMENT, _(u"Invalid storage value: '%s'") %
   681                   ctx.args[3], ctx.scmd)
   681                   ctx.args[3], ctx.scmd)
   699         usage(EX_MISSING_ARGS, _(u'Missing e-mail address.'), ctx.scmd)
   699         usage(EX_MISSING_ARGS, _(u'Missing e-mail address.'), ctx.scmd)
   700     services = []
   700     services = []
   701     if ctx.argc >= 4:
   701     if ctx.argc >= 4:
   702         services.extend([service.lower() for service in ctx.args[3:]])
   702         services.extend([service.lower() for service in ctx.args[3:]])
   703         unknown = [service for service in services if service not in SERVICES]
   703         unknown = [service for service in services if service not in SERVICES]
   704         if unknown and ctx.args[3] != 'default':
   704         if unknown and ctx.args[3] != 'domain':
   705             usage(INVALID_ARGUMENT, _(u'Invalid service arguments: %s') %
   705             usage(INVALID_ARGUMENT, _(u'Invalid service arguments: %s') %
   706                   ' '.join(unknown), ctx.scmd)
   706                   ' '.join(unknown), ctx.scmd)
   707     ctx.hdlr.user_services(ctx.args[2].lower(), *services)
   707     ctx.hdlr.user_services(ctx.args[2].lower(), *services)
   708 
   708 
   709 
   709 
   777                     _(u'set or update the real name for an address')),
   777                     _(u'set or update the real name for an address')),
   778     'userpassword': cmd('userpassword', 'up', user_password,
   778     'userpassword': cmd('userpassword', 'up', user_password,
   779                         'address [password]',
   779                         'address [password]',
   780                         _(u'update the password for the given address')),
   780                         _(u'update the password for the given address')),
   781     'userquota': cmd('userquota', 'uq', user_quota,
   781     'userquota': cmd('userquota', 'uq', user_quota,
   782                      'address storage [messages] | address default',
   782                      'address storage [messages] | address domain',
   783                      _(u'update the quota limit for the given address')),
   783                      _(u'update the quota limit for the given address')),
   784     'userservices': cmd('userservices', 'us', user_services,
   784     'userservices': cmd('userservices', 'us', user_services,
   785                         'address [service ...] | address default',
   785                         'address [service ...] | address domain',
   786                         _(u'enables the specified services and disables all '
   786                         _(u'enables the specified services and disables all '
   787                           u'not specified services')),
   787                           u'not specified services')),
   788     'usertransport': cmd('usertransport', 'ut', user_transport,
   788     'usertransport': cmd('usertransport', 'ut', user_transport,
   789                          'address transport | address default',
   789                          'address transport | address domain',
   790                          _(u'update the transport of the given address')),
   790                          _(u'update the transport of the given address')),
   791     'usernote': cmd('usernote', 'uo', user_note,
   791     'usernote': cmd('usernote', 'uo', user_note,
   792                     'address note',
   792                     'address note',
   793                     _(u'update the note of the given address')),
   793                     _(u'update the note of the given address')),
   794     # Alias commands
   794     # Alias commands