VirtualMailManager/cli/subcommands.py
branchv0.6.x
changeset 414 ae1a8428298c
parent 413 e5b3b225bd5b
child 417 8209da83e256
equal deleted inserted replaced
413:e5b3b225bd5b 414:ae1a8428298c
   255             ctx.scmd = ctx.args[1] = 'aliasdomaininfo'
   255             ctx.scmd = ctx.args[1] = 'aliasdomaininfo'
   256             aliasdomain_info(ctx)
   256             aliasdomain_info(ctx)
   257         else:
   257         else:
   258             raise
   258             raise
   259     else:
   259     else:
   260         q_limit = u'Storage: %(bytes)s; Messages: %(messages)u'
   260         q_limit = u'Storage: %(bytes)s; Messages: %(messages)s'
   261         if not details:
   261         if not details:
   262             info['bytes'] = human_size(info['bytes'])
   262             info['bytes'] = human_size(info['bytes'])
       
   263             info['messages'] = locale.format('%d', info['messages'], True)
   263             info['quota limit'] = q_limit % info
   264             info['quota limit'] = q_limit % info
   264             _print_info(ctx, info, _(u'Domain'))
   265             _print_info(ctx, info, _(u'Domain'))
   265         else:
   266         else:
   266             info[0]['bytes'] = human_size(info[0]['bytes'])
   267             info[0]['bytes'] = human_size(info[0]['bytes'])
       
   268             info[0]['messages'] = locale.format('%d', info[0]['messages'],
       
   269                                                 True)
   267             info[0]['quota limit'] = q_limit % info[0]
   270             info[0]['quota limit'] = q_limit % info[0]
   268             _print_info(ctx, info[0], _(u'Domain'))
   271             _print_info(ctx, info[0], _(u'Domain'))
   269             if details == u'accounts':
   272             if details == u'accounts':
   270                 _print_list(info[1], _(u'accounts'))
   273                 _print_list(info[1], _(u'accounts'))
   271             elif details == u'aliasdomains':
   274             elif details == u'aliasdomains':
   749             'used': human_size(used),
   752             'used': human_size(used),
   750             'limit': human_size(limit),
   753             'limit': human_size(limit),
   751         }
   754         }
   752     else:
   755     else:
   753         q_usage = {
   756         q_usage = {
   754             'used': used,
   757             'used': locale.format('%d', used, True),
   755             'limit': limit,
   758             'limit': locale.format('%d', limit, True),
   756         }
   759         }
   757     if limit:
   760     if limit:
   758         q_usage['percent'] = 100. / limit * used
   761         q_usage['percent'] = locale.format('%6.2f', 100. / limit * used, True)
   759     else:
   762     else:
   760         q_usage['percent'] = 0.
   763         q_usage['percent'] = locale.format('%6.2f', 0, True)
   761     return _(u'[%(percent)6.2f%%] %(used)s/%(limit)s') % q_usage
   764     return _(u'[%(percent)s%%] %(used)s/%(limit)s') % q_usage
   762 
   765 
   763 
   766 
   764 def _print_info(ctx, info, title):
   767 def _print_info(ctx, info, title):
   765     """Print info dicts."""
   768     """Print info dicts."""
   766     # TP: used in e.g. 'Domain information' or 'Account information'
   769     # TP: used in e.g. 'Domain information' or 'Account information'