VMM/{account,domain}: Added a versions check to the update_quotalimit
methods of classes Account and Domain.
--- a/VirtualMailManager/account.py Sun Feb 13 04:33:55 2011 +0000
+++ b/VirtualMailManager/account.py Sun Feb 13 05:01:04 2011 +0000
@@ -16,8 +16,8 @@
from VirtualMailManager.constants import \
ACCOUNT_EXISTS, ACCOUNT_MISSING_PASSWORD, ALIAS_PRESENT, \
INVALID_ARGUMENT, INVALID_MAIL_LOCATION, NO_SUCH_ACCOUNT, \
- NO_SUCH_DOMAIN, UNKNOWN_SERVICE
-from VirtualMailManager.errors import AccountError as AErr
+ NO_SUCH_DOMAIN, UNKNOWN_SERVICE, VMM_ERROR
+from VirtualMailManager.errors import VMMError, AccountError as AErr
from VirtualMailManager.maillocation import MailLocation
from VirtualMailManager.password import pwhash
@@ -319,6 +319,9 @@
`quotalimit` : VirtualMailManager.quotalimit.QuotaLimit
the new quota limit of the domain.
"""
+ if cfg_dget('misc.dovecot_version') < 0x10102f00:
+ raise VMMError(_(u'PostgreSQL-based dictionary quota requires '
+ u'Dovecot >= v1.1.2'), VMM_ERROR)
self._chk_state()
assert isinstance(quotalimit, QuotaLimit)
if quotalimit == self._qlimit:
--- a/VirtualMailManager/domain.py Sun Feb 13 04:33:55 2011 +0000
+++ b/VirtualMailManager/domain.py Sun Feb 13 05:01:04 2011 +0000
@@ -14,8 +14,8 @@
from VirtualMailManager.constants import \
ACCOUNT_AND_ALIAS_PRESENT, DOMAIN_ALIAS_EXISTS, DOMAIN_EXISTS, \
- DOMAIN_INVALID, DOMAIN_TOO_LONG, NO_SUCH_DOMAIN
-from VirtualMailManager.errors import DomainError as DomErr
+ DOMAIN_INVALID, DOMAIN_TOO_LONG, NO_SUCH_DOMAIN, VMM_ERROR
+from VirtualMailManager.errors import VMMError, DomainError as DomErr
from VirtualMailManager.pycompat import all, any
from VirtualMailManager.quotalimit import QuotaLimit
from VirtualMailManager.transport import Transport
@@ -24,6 +24,7 @@
MAILDIR_CHARS = '0123456789abcdefghijklmnopqrstuvwxyz'
RE_DOMAIN = re.compile(r"^(?:[a-z0-9-]{1,63}\.){1,}[a-z]{2,6}$")
_ = lambda msg: msg
+cfg_dget = lambda option: None
class Domain(object):
@@ -266,6 +267,9 @@
`force` : bool
enforce new quota limit for all accounts, default `False`
"""
+ if cfg_dget('misc.dovecot_version') < 0x10102f00:
+ raise VMMError(_(u'PostgreSQL-based dictionary quota requires '
+ u'Dovecot >= v1.1.2'), VMM_ERROR)
self._chk_state()
assert isinstance(quotalimit, QuotaLimit)
if not force and quotalimit == self._qlimit:
@@ -459,4 +463,4 @@
domains[gid] = [None, domain]
return gids, domains
-del _
+del _, cfg_dget