# HG changeset patch # User Pascal Volk # Date 1340802688 0 # Node ID b0165b7af7a361ef9e6db7d29f6f164819ea8050 # Parent 2662f4e17eb4666a1dcaac1a85eada9b4c464288 VMM: The Python 2.4.x compatibility commit - part III. diff -r 2662f4e17eb4 -r b0165b7af7a3 VirtualMailManager/account.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() diff -r 2662f4e17eb4 -r b0165b7af7a3 VirtualMailManager/cli/subcommands.py --- 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)