VMM/handler: Handler.relocated_add() check if the target address' v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Mon, 17 Jan 2011 20:19:14 +0000
branchv0.6.x
changeset 373 1016a17684c1
parent 372 ef99be5b7ec0
child 374 ecdba68c7a2c
VMM/handler: Handler.relocated_add() check if the target address' domain is known, if so add a warning when the account/alias doesn't exist.
VirtualMailManager/handler.py
--- a/VirtualMailManager/handler.py	Mon Jan 17 19:44:36 2011 +0000
+++ b/VirtualMailManager/handler.py	Mon Jan 17 20:19:14 2011 +0000
@@ -711,8 +711,12 @@
         already a relocated user with the given *emailaddress*, only the
         *targetaddress* for the relocated user will be updated."""
         relocated = self._get_relocated(emailaddress)
-        relocated.set_destination(DestinationEmailAddress(targetaddress,
-                                                          self._dbh))
+        destination = DestinationEmailAddress(targetaddress, self._dbh)
+        relocated.set_destination(destination)
+        if destination.gid and \
+           not self._chk_other_address_types(destination, TYPE_RELOCATED):
+            self._warnings.append(_(u"The destination account/alias '%s' "
+                                    u"doesn't exist.") % destination)
 
     def relocated_info(self, emailaddress):
         """Returns the target address of the relocated user with the given