# HG changeset patch # User Pascal Volk # Date 1340799533 0 # Node ID cc0f67f99780ffc5702c3564b0a66fd5a37ef34a # Parent 2fcf12fdecc25cdc9bed68544faa50ba2d83190d VMM: The Python 2.4.x compatibility commit. diff -r 2fcf12fdecc2 -r cc0f67f99780 VirtualMailManager/account.py --- a/VirtualMailManager/account.py Thu Jun 14 20:45:12 2012 +0000 +++ b/VirtualMailManager/account.py Wed Jun 27 12:18:53 2012 +0000 @@ -85,11 +85,17 @@ self._uid, _mid, _qid, _ssid, _tid, _note = result def load_helper(ctor, own, field, dbresult): - cur = None if own is None else getattr(own, field) + # Py25: cur = None if own is None else getattr(own, field) + if own is None: + cur = None + else: + cur = getattr(own, field) if cur != dbresult: - kwargs = { field : dbresult } - return None if dbresult is None \ - else ctor(self._dbh, **kwargs) + kwargs = {field: dbresult} + if dbresult is None: + return dbresult + else: + return ctor(self._dbh, **kwargs) self._qlimit = load_helper(QuotaLimit, self._qlimit, 'qid', _qid) self._services = load_helper(ServiceSet, self._services, 'ssid', diff -r 2fcf12fdecc2 -r cc0f67f99780 VirtualMailManager/cli/subcommands.py --- a/VirtualMailManager/cli/subcommands.py Thu Jun 14 20:45:12 2012 +0000 +++ b/VirtualMailManager/cli/subcommands.py Wed Jun 27 12:18:53 2012 +0000 @@ -673,12 +673,14 @@ ctx.scmd) elif ctx.argc < 4: usage(EX_MISSING_ARGS, _(u'Missing storage value.'), ctx.scmd) - try: - bytes_ = ctx.args[3] if ctx.args[3] == 'default' \ - else size_in_bytes(ctx.args[3]) - except (ValueError, TypeError): - usage(INVALID_ARGUMENT, _(u"Invalid storage value: '%s'") % - ctx.args[3], ctx.scmd) + if ctx.args[3] != 'default': + try: + bytes_ = size_in_bytes(ctx.args[3]) + except (ValueError, TypeError): + usage(INVALID_ARGUMENT, _(u"Invalid storage value: '%s'") % + ctx.args[3], ctx.scmd) + else: + bytes_ = ctx.args[3] if ctx.argc < 5: messages = 0 else: diff -r 2fcf12fdecc2 -r cc0f67f99780 VirtualMailManager/handler.py --- a/VirtualMailManager/handler.py Thu Jun 14 20:45:12 2012 +0000 +++ b/VirtualMailManager/handler.py Wed Jun 27 12:18:53 2012 +0000 @@ -832,8 +832,10 @@ if not acc: raise VMMError(_(u"The account '%s' does not exist.") % acc.address, NO_SUCH_ACCOUNT) - transport = None if transport == 'default' \ - else Transport(self._dbh, transport=transport) + if transport == 'default': + transport = None + else: + transport = Transport(self._dbh, transport=transport) acc.update_transport(transport) def user_services(self, emailaddress, *services):