VirtualMailManager/Alias.py
branchv0.6.x
changeset 222 d0c16e70a9fb
parent 221 371ae0b4443d
child 223 5c7b7cbb01cd
equal deleted inserted replaced
221:371ae0b4443d 222:d0c16e70a9fb
    10 
    10 
    11 from VirtualMailManager.Domain import get_gid
    11 from VirtualMailManager.Domain import get_gid
    12 from VirtualMailManager.EmailAddress import EmailAddress
    12 from VirtualMailManager.EmailAddress import EmailAddress
    13 from VirtualMailManager.errors import AliasError as AErr
    13 from VirtualMailManager.errors import AliasError as AErr
    14 from VirtualMailManager.pycompat import all
    14 from VirtualMailManager.pycompat import all
    15 from VirtualMailManager.constants.ERROR import ALIAS_ADDR_DEST_IDENTICAL, \
    15 from VirtualMailManager.constants.ERROR import \
    16      ALIAS_EXCEEDS_EXPANSION_LIMIT, ALIAS_EXISTS, NO_SUCH_ALIAS
    16      ALIAS_EXCEEDS_EXPANSION_LIMIT, NO_SUCH_ALIAS, NO_SUCH_DOMAIN
    17 
    17 
    18 
    18 
    19 _ = lambda msg: msg
    19 _ = lambda msg: msg
    20 
    20 
    21 
    21 
    26     def __init__(self, dbh, address):
    26     def __init__(self, dbh, address):
    27         assert isinstance(address, EmailAddress)
    27         assert isinstance(address, EmailAddress)
    28         self._addr = address
    28         self._addr = address
    29         self._dbh = dbh
    29         self._dbh = dbh
    30         self._gid = get_gid(self._dbh, self._addr.domainname)
    30         self._gid = get_gid(self._dbh, self._addr.domainname)
       
    31         if not self._gid:
       
    32             raise AErr(_(u"The domain %r doesn't exist.") %
       
    33                        self._addr.domainname, NO_SUCH_DOMAIN)
    31         self._dests = []
    34         self._dests = []
    32 
    35 
    33         self.__load_dests()
    36         self.__load_dests()
    34 
    37 
    35     def __load_dests(self):
    38     def __load_dests(self):