VirtualMailManager/Relocated.py
branchv0.6.x
changeset 213 1a9fee6b93bc
parent 202 43e7c8b440da
child 215 33f727efa7c4
equal deleted inserted replaced
212:77ac6f572855 213:1a9fee6b93bc
    26         """Creates a new *Relocated* instance. The ``address`` is the
    26         """Creates a new *Relocated* instance. The ``address`` is the
    27         old e-mail address of the user.
    27         old e-mail address of the user.
    28 
    28 
    29         Use `setDestination()` to set/update the new address, where the
    29         Use `setDestination()` to set/update the new address, where the
    30         user has moved to."""
    30         user has moved to."""
    31         if not isinstance(address, EmailAddress):
    31         assert isinstance(address, EmailAddress)
    32             raise TypeError("Argument 'address' is not an EmailAddress")
       
    33         self._addr = address
    32         self._addr = address
    34         self._dbh = dbh
    33         self._dbh = dbh
    35         self._gid = get_gid(self._dbh, self._addr.domainname)
    34         self._gid = get_gid(self._dbh, self._addr.domainname)
    36         self._dest = None
    35         self._dest = None
    37 
    36 
    50             self._dest = EmailAddress(destination[0])
    49             self._dest = EmailAddress(destination[0])
    51 
    50 
    52     def setDestination(self, destination):
    51     def setDestination(self, destination):
    53         """Sets/updates the new address of the relocated user."""
    52         """Sets/updates the new address of the relocated user."""
    54         update = False
    53         update = False
    55         if not isinstance(destination, EmailAddress):
    54         assert isinstance(destination, EmailAddress)
    56             raise TypeError("Argument 'destination' is not an EmailAddress")
       
    57         if self._addr == destination:
    55         if self._addr == destination:
    58             raise VMMRE(_(u'Address and destination are identical.'),
    56             raise VMMRE(_(u'Address and destination are identical.'),
    59                         RELOCATED_ADDR_DEST_IDENTICAL)
    57                         RELOCATED_ADDR_DEST_IDENTICAL)
    60         if self._dest:
    58         if self._dest:
    61             if self._dest == destination:
    59             if self._dest == destination: