VirtualMailManager/common.py
branchv0.7.x
changeset 653 cf07e4468934
parent 643 df1e3b67882a
child 670 f374ef062c94
equal deleted inserted replaced
652:68d715ce6e1c 653:cf07e4468934
    85     for prefix, multiply in prefix_multiply:
    85     for prefix, multiply in prefix_multiply:
    86         if size >= multiply:
    86         if size >= multiply:
    87             # TP: e.g.: '%(size)s %(prefix)s' -> '118.30 MiB'
    87             # TP: e.g.: '%(size)s %(prefix)s' -> '118.30 MiB'
    88             return _('%(size)s %(prefix)s') % {
    88             return _('%(size)s %(prefix)s') % {
    89                     'size': locale.format('%.2f', float(size) / multiply,
    89                     'size': locale.format('%.2f', float(size) / multiply,
    90                                           True).decode(ENCODING, 'replace'),
    90                                           True),
    91                     'prefix': prefix}
    91                     'prefix': prefix}
    92 
    92 
    93 
    93 
    94 def size_in_bytes(size):
    94 def size_in_bytes(size):
    95     """Converts the string `size` to a long (size in bytes).
    95     """Converts the string `size` to a long (size in bytes).
   195     minor = (version >> 20) & 0xFF
   195     minor = (version >> 20) & 0xFF
   196     patch = (version >> 12) & 0xFF
   196     patch = (version >> 12) & 0xFF
   197     level = (version >> 8) & 0x0F
   197     level = (version >> 8) & 0x0F
   198     serial = version & 0xFF
   198     serial = version & 0xFF
   199 
   199 
   200     levels = dict(list(zip(list(_version_level.values()), list(_version_level.keys()))))
   200     levels = dict(list(zip(list(_version_level.values()),
       
   201                   list(_version_level.keys()))))
   201     if level == 0xF and not serial:
   202     if level == 0xF and not serial:
   202         version_string = '%u.%u.%u' % (major, minor, patch)
   203         version_string = '%u.%u.%u' % (major, minor, patch)
   203     elif level in levels and not patch:
   204     elif level in levels and not patch:
   204         version_string = '%u.%u.%s%u' % (major, minor, levels[level], serial)
   205         version_string = '%u.%u.%s%u' % (major, minor, levels[level], serial)
   205     else:
   206     else: