VMM: The Python 2.4.x compatibility commit - part III. v0.6.x
authorPascal Volk <user@localhost.localdomain.org>
Wed, 27 Jun 2012 13:11:28 +0000
branchv0.6.x
changeset 561 b0165b7af7a3
parent 560 2662f4e17eb4
child 562 b5bb7b34e831
VMM: The Python 2.4.x compatibility commit - part III.
VirtualMailManager/account.py
VirtualMailManager/cli/subcommands.py
--- a/VirtualMailManager/account.py	Wed Jun 27 12:46:27 2012 +0000
+++ b/VirtualMailManager/account.py	Wed Jun 27 13:11:28 2012 +0000
@@ -251,15 +251,22 @@
         self._prepare(MailLocation(self._dbh, mbfmt=cfg_dget('mailbox.format'),
                                    directory=cfg_dget('mailbox.root')))
         dbc = self._dbh.cursor()
+        qid = ssid = tid = None
+        if self._qlimit:
+            qid = self._qlimit.qid
+        if self._services:
+            ssid = self._services.ssid
+        if self._transport:
+            tid = self._transport.tid
         dbc.execute('INSERT INTO users (local_part, passwd, uid, gid, mid, '
                     'qid, ssid, tid, note) '
                     'VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)',
                     (self._addr.localpart,
                      pwhash(self._passwd, user=self._addr), self._uid,
-                     self._domain.gid, self._mail.mid,
-                     self._qlimit.qid if self._qlimit else None,
-                     self._services.ssid if self._services else None,
-                     self._transport.tid if self._transport else None,
+                     self._domain.gid, self._mail.mid, qid, ssid, tid,
+#                     self._qlimit.qid if self._qlimit else None,
+#                     self._services.ssid if self._services else None,
+#                     self._transport.tid if self._transport else None,
                      self._note))
         self._dbh.commit()
         dbc.close()
--- a/VirtualMailManager/cli/subcommands.py	Wed Jun 27 12:46:27 2012 +0000
+++ b/VirtualMailManager/cli/subcommands.py	Wed Jun 27 13:11:28 2012 +0000
@@ -924,7 +924,11 @@
         q_usage['percent'] = locale.format('%6.2f', 100. / limit * used, True)
     else:
         q_usage['percent'] = locale.format('%6.2f', 0, True)
-    fmt = format_domain_default if domaindefault else lambda s: s
+    #  Py25: fmt = format_domain_default if domaindefault else lambda s: s
+    if domaindefault:
+        fmt = format_domain_default
+    else:
+        fmt = lambda s: s
     return fmt(_(u'[%(percent)s%%] %(used)s/%(limit)s') % q_usage)