VirtualMailManager/cli/subcommands.py
branchv0.6.x
changeset 533 2676dbf43e1c
parent 532 2bb40aaef94e
child 536 c340ba4bd544
equal deleted inserted replaced
532:2bb40aaef94e 533:2676dbf43e1c
   615         usage(EX_MISSING_ARGS, _(u'Missing e-mail address and storage value.'),
   615         usage(EX_MISSING_ARGS, _(u'Missing e-mail address and storage value.'),
   616               ctx.scmd)
   616               ctx.scmd)
   617     elif ctx.argc < 4:
   617     elif ctx.argc < 4:
   618         usage(EX_MISSING_ARGS, _(u'Missing storage value.'), ctx.scmd)
   618         usage(EX_MISSING_ARGS, _(u'Missing storage value.'), ctx.scmd)
   619     try:
   619     try:
   620         bytes_ = size_in_bytes(ctx.args[3])
   620         bytes_ = ctx.args[3] if ctx.args[3] == 'default' \
       
   621                              else size_in_bytes(ctx.args[3])
   621     except (ValueError, TypeError):
   622     except (ValueError, TypeError):
   622         usage(INVALID_ARGUMENT, _(u"Invalid storage value: '%s'") %
   623         usage(INVALID_ARGUMENT, _(u"Invalid storage value: '%s'") %
   623               ctx.args[3], ctx.scmd)
   624               ctx.args[3], ctx.scmd)
   624     if ctx.argc < 5:
   625     if ctx.argc < 5:
   625         messages = 0
   626         messages = 0
   639         usage(EX_MISSING_ARGS, _(u'Missing e-mail address.'), ctx.scmd)
   640         usage(EX_MISSING_ARGS, _(u'Missing e-mail address.'), ctx.scmd)
   640     services = []
   641     services = []
   641     if ctx.argc >= 4:
   642     if ctx.argc >= 4:
   642         services.extend([service.lower() for service in ctx.args[3:]])
   643         services.extend([service.lower() for service in ctx.args[3:]])
   643         unknown = [service for service in services if service not in SERVICES]
   644         unknown = [service for service in services if service not in SERVICES]
   644         if unknown:
   645         if unknown and ctx.args[3] != 'default':
   645             usage(INVALID_ARGUMENT, _(u'Invalid service arguments: %s') %
   646             usage(INVALID_ARGUMENT, _(u'Invalid service arguments: %s') %
   646                   ' '.join(unknown), ctx.scmd)
   647                   ' '.join(unknown), ctx.scmd)
   647     ctx.hdlr.user_services(ctx.args[2].lower(), *services)
   648     ctx.hdlr.user_services(ctx.args[2].lower(), *services)
   648 
   649 
   649 
   650 
   717                     _(u'set or update the real name for an address')),
   718                     _(u'set or update the real name for an address')),
   718     'userpassword': cmd('userpassword', 'up', user_password,
   719     'userpassword': cmd('userpassword', 'up', user_password,
   719                         'address [password]',
   720                         'address [password]',
   720                         _(u'update the password for the given address')),
   721                         _(u'update the password for the given address')),
   721     'userquota': cmd('userquota', 'uq', user_quota,
   722     'userquota': cmd('userquota', 'uq', user_quota,
   722                      'address storage [messages]',
   723                      'address storage [messages] | address default',
   723                      _(u'update the quota limit for the given address')),
   724                      _(u'update the quota limit for the given address')),
   724     'userservices': cmd('userservices', 'us', user_services,
   725     'userservices': cmd('userservices', 'us', user_services,
   725                         'address [service ...]',
   726                         'address [service ...] | address default',
   726                         _(u'enables the specified services and disables all '
   727                         _(u'enables the specified services and disables all '
   727                           u'not specified services')),
   728                           u'not specified services')),
   728     'usertransport': cmd('usertransport', 'ut', user_transport,
   729     'usertransport': cmd('usertransport', 'ut', user_transport,
   729                          'address transport',
   730                          'address transport | address default',
   730                          _(u'update the transport of the given address')),
   731                          _(u'update the transport of the given address')),
   731     # Alias commands
   732     # Alias commands
   732     'aliasadd': cmd('aliasadd', 'aa', alias_add, 'address destination ...',
   733     'aliasadd': cmd('aliasadd', 'aa', alias_add, 'address destination ...',
   733                     _(u'create a new alias e-mail address with one or more '
   734                     _(u'create a new alias e-mail address with one or more '
   734                       u'destinations')),
   735                       u'destinations')),