VirtualMailManager/cli/subcommands.py
changeset 601 463b10c258d9
parent 600 0571f45501da
child 602 af88f01e5bfa
equal deleted inserted replaced
600:0571f45501da 601:463b10c258d9
   293             raise
   293             raise
   294     else:
   294     else:
   295         q_limit = u'Storage: %(bytes)s; Messages: %(messages)s'
   295         q_limit = u'Storage: %(bytes)s; Messages: %(messages)s'
   296         if not details:
   296         if not details:
   297             info['bytes'] = human_size(info['bytes'])
   297             info['bytes'] = human_size(info['bytes'])
   298             info['messages'] = locale.format('%d', info['messages'], True)
   298             info['messages'] = locale.format('%d', info['messages'],
       
   299                                              True).decode(ENCODING, 'replace')
   299             info['quota limit/user'] = q_limit % info
   300             info['quota limit/user'] = q_limit % info
   300             _print_info(ctx, info, _(u'Domain'))
   301             _print_info(ctx, info, _(u'Domain'))
   301         else:
   302         else:
   302             info[0]['bytes'] = human_size(info[0]['bytes'])
   303             info[0]['bytes'] = human_size(info[0]['bytes'])
   303             info[0]['messages'] = locale.format('%d', info[0]['messages'],
   304             info[0]['messages'] = locale.format('%d', info[0]['messages'],
   304                                                 True)
   305                                                 True).decode(ENCODING,
       
   306                                                              'replace')
   305             info[0]['quota limit/user'] = q_limit % info[0]
   307             info[0]['quota limit/user'] = q_limit % info[0]
   306             _print_info(ctx, info[0], _(u'Domain'))
   308             _print_info(ctx, info[0], _(u'Domain'))
   307             if details == u'accounts':
   309             if details == u'accounts':
   308                 _print_list(info[1], _(u'accounts'))
   310                 _print_list(info[1], _(u'accounts'))
   309             elif details == u'aliasdomains':
   311             elif details == u'aliasdomains':
   915             'used': human_size(used),
   917             'used': human_size(used),
   916             'limit': human_size(limit),
   918             'limit': human_size(limit),
   917         }
   919         }
   918     else:
   920     else:
   919         q_usage = {
   921         q_usage = {
   920             'used': locale.format('%d', used, True),
   922             'used': locale.format('%d', used, True).decode(ENCODING,
   921             'limit': locale.format('%d', limit, True),
   923                                                            'replace'),
       
   924             'limit': locale.format('%d', limit, True).decode(ENCODING,
       
   925                                                              'replace'),
   922         }
   926         }
   923     if limit:
   927     if limit:
   924         q_usage['percent'] = locale.format('%6.2f', 100. / limit * used, True)
   928         q_usage['percent'] = locale.format('%6.2f', 100. / limit * used, True)
   925     else:
   929     else:
   926         q_usage['percent'] = locale.format('%6.2f', 0, True)
   930         q_usage['percent'] = locale.format('%6.2f', 0, True)