VMM/*: Post-2to3 fix. Updated some error messages/comments. v0.7.x
authorPascal Volk <user@localhost.localdomain.org>
Sun, 30 Dec 2012 18:08:23 +0000
branchv0.7.x
changeset 670 f374ef062c94
parent 669 d765a878f0fc
child 671 a9d86ccac044
VMM/*: Post-2to3 fix. Updated some error messages/comments. Replaced `long' by `int' (or integer).
VirtualMailManager/account.py
VirtualMailManager/common.py
VirtualMailManager/config.py
VirtualMailManager/handler.py
VirtualMailManager/quotalimit.py
VirtualMailManager/transport.py
--- a/VirtualMailManager/account.py	Sun Dec 30 16:41:19 2012 +0000
+++ b/VirtualMailManager/account.py	Sun Dec 30 18:08:23 2012 +0000
@@ -133,7 +133,7 @@
 
         `column` : basestring
           Name of the table column. Currently: qid, ssid and tid
-        `value` : long
+        `value` : int
           The referenced key
         """
         if column not in ('qid', 'ssid', 'tid'):
@@ -460,7 +460,7 @@
 
     Argument:
 
-    `uid` : long
+    `uid` : int
       The Account unique ID.
     `dbh` : pyPgSQL.PgSQL.Connection
       a database connection for the database access.
@@ -468,7 +468,7 @@
     try:
         uid = int(uid)
     except ValueError:
-        raise AErr(_('UID must be an int/long.'), INVALID_ARGUMENT)
+        raise AErr(_('UID must be an integer.'), INVALID_ARGUMENT)
     if uid < 1:
         raise AErr(_('UID must be greater than 0.'), INVALID_ARGUMENT)
     dbc = dbh.cursor()
--- a/VirtualMailManager/common.py	Sun Dec 30 16:41:19 2012 +0000
+++ b/VirtualMailManager/common.py	Sun Dec 30 18:08:23 2012 +0000
@@ -74,9 +74,9 @@
         try:
             size = int(size)
         except ValueError:
-            raise TypeError("'size' must be a positive long or int.")
+            raise TypeError("'size' must be a positive integer.")
     if size < 0:
-        raise ValueError("'size' must be a positive long or int.")
+        raise ValueError("'size' must be a positive integer.")
     if size < 1024:
         return str(size)
     # TP: abbreviations of gibibyte, tebibyte kibibyte and mebibyte
@@ -92,7 +92,7 @@
 
 
 def size_in_bytes(size):
-    """Converts the string `size` to a long (size in bytes).
+    """Converts the string `size` to an integer (size in bytes).
 
     The string `size` can be suffixed with *b* (bytes), *k* (kilobytes),
     *M* (megabytes) or *G* (gigabytes).
@@ -183,14 +183,14 @@
 def version_str(version):
     """Converts a Dovecot version previously converted with version_hex back to
     a string.
-    Raises a `TypeError` if *version* is not an int/long.
+    Raises a `TypeError` if *version* is not an integer.
     Raises a `ValueError` if *version* is an incorrect int version.
     """
     global _version_cache
     if version in _version_cache:
         return _version_cache[version]
     if not isinstance(version, int):
-        raise TypeError('Argument is not a int/long: %r', version)
+        raise TypeError('Argument is not a integer: %r', version)
     major = (version >> 28) & 0xFF
     minor = (version >> 20) & 0xFF
     patch = (version >> 12) & 0xFF
--- a/VirtualMailManager/config.py	Sun Dec 30 16:41:19 2012 +0000
+++ b/VirtualMailManager/config.py	Sun Dec 30 18:08:23 2012 +0000
@@ -406,7 +406,7 @@
 
     def get_in_bytes(self, section, option):
         """Converts the size value (e.g.: 1024k) from the *option*'s
-        value to a long"""
+        value to a integer"""
         return size_in_bytes(self.get(section, option))
 
     def str(self, section, option):
--- a/VirtualMailManager/handler.py	Sun Dec 30 16:41:19 2012 +0000
+++ b/VirtualMailManager/handler.py	Sun Dec 30 18:08:23 2012 +0000
@@ -345,9 +345,9 @@
         `domdir` : basestring
           The directory of the domain the user belongs to
           (commonly AccountObj.domain.directory)
-        `uid` : int/long
+        `uid` : int
           The user's UID (commonly AccountObj.uid)
-        `gid` : int/long
+        `gid` : int
           The user's GID (commonly AccountObj.gid)
         """
         assert all(isinstance(xid, int) for xid in (uid, gid)) and \
@@ -382,7 +382,7 @@
 
         `domdir` : basestring
           The domain's directory (commonly DomainObj.directory)
-        `gid` : int/long
+        `gid` : int
           The domain's GID (commonly DomainObj.gid)
         """
         assert isinstance(domdir, str) and isinstance(gid, int)
--- a/VirtualMailManager/quotalimit.py	Sun Dec 30 16:41:19 2012 +0000
+++ b/VirtualMailManager/quotalimit.py	Sun Dec 30 18:08:23 2012 +0000
@@ -32,7 +32,7 @@
 
         `qid` : int
           The id of a quota limit
-        `bytes` : long
+        `bytes` : int
           The quota limit in bytes.
         `messages` : int
           The quota limit in number of messages
--- a/VirtualMailManager/transport.py	Sun Dec 30 16:41:19 2012 +0000
+++ b/VirtualMailManager/transport.py	Sun Dec 30 18:08:23 2012 +0000
@@ -24,7 +24,7 @@
 
         Keyword arguments:
         dbh -- a pyPgSQL.PgSQL.connection
-        tid -- the id of a transport (int/long)
+        tid -- the id of a transport (int)
         transport -- the value of the transport (str)
 
         """