VirtualMailManager/Relocated.py
branchv0.6.x
changeset 222 d0c16e70a9fb
parent 216 0c8c053b451c
child 249 bb7d9906c529
equal deleted inserted replaced
221:371ae0b4443d 222:d0c16e70a9fb
     9 """
     9 """
    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 RelocatedError as RErr
    13 from VirtualMailManager.errors import RelocatedError as RErr
    14 from VirtualMailManager.constants.ERROR import \
    14 from VirtualMailManager.constants.ERROR import NO_SUCH_DOMAIN, \
    15      NO_SUCH_RELOCATED, RELOCATED_ADDR_DEST_IDENTICAL, RELOCATED_EXISTS
    15      NO_SUCH_RELOCATED, RELOCATED_ADDR_DEST_IDENTICAL, RELOCATED_EXISTS
    16 
    16 
    17 
    17 
    18 _ = lambda msg: msg
    18 _ = lambda msg: msg
    19 
    19 
    32         """
    32         """
    33         assert isinstance(address, EmailAddress)
    33         assert isinstance(address, EmailAddress)
    34         self._addr = address
    34         self._addr = address
    35         self._dbh = dbh
    35         self._dbh = dbh
    36         self._gid = get_gid(self._dbh, self._addr.domainname)
    36         self._gid = get_gid(self._dbh, self._addr.domainname)
       
    37         if not self._gid:
       
    38             raise RErr(_(u"The domain %r doesn't exist.") %
       
    39                        self._addr.domainname, NO_SUCH_DOMAIN)
    37         self._dest = None
    40         self._dest = None
    38 
    41 
    39         self.__load()
    42         self.__load()
    40 
    43 
    41     def __load(self):
    44     def __load(self):