Commits

Zhang Huangbin committed cc84970

Fix incorrect quota while create new mail user. Thanks Edison.

Comments (0)

Files changed (2)

libs/iredutils.py

 
 cfg = web.iredconfig
 
-def filesizeformat(value, binary=False):
+def filesizeformat(value):
     """Format the value like a 'human-readable' file size (i.e. 13 KB,
     4.1 MB, 102 bytes, etc).  Per default decimal prefixes are used (mega,
     giga etc.), if the second parameter is set to `True` the binary
     prefixes are (mebi, gibi).
     """
     bytes = float(value)
-    base = binary and 1024 or 1000
-    middle = binary and 'i' or ''
+    base = 1024
     if bytes < base:
         return "%d Byte%s" % (bytes, bytes != 1 and 's' or '')
     elif bytes < base * base:
-        return "%d K%sB" % (bytes / base, middle)
+        return "%d KB" % (bytes / base)
     elif bytes < base * base * base:
-        return "%d M%sB" % (bytes / (base * base), middle)
-    return "%.1f G%sB" % (bytes / (base * base * base), middle)
+        return "%d M%sB" % (bytes / (base * base))
+    return "%.1f G%sB" % (bytes / (base * base * base))
 
 def get_translation(lang):
     # Init translations.

libs/ldaplib/user.py

             return result
 
         self.cn = data.get('cn')
-        self.quota = data.get('quota', domainLib.getDomainDefaultUserQuota(self.domain))
+        self.quota = data.get('mailQuota', domainLib.getDomainDefaultUserQuota(self.domain))
 
         ldif = iredldif.ldif_mailuser(
                 domain=self.domain,