VirtualMailManager/Domain.py
changeset 18 c98e08791ee8
parent 9 e3d3dbeb5b84
child 24 48ea255e8a85
--- a/VirtualMailManager/Domain.py	Tue Apr 15 01:28:34 2008 +0000
+++ b/VirtualMailManager/Domain.py	Tue Apr 15 02:49:21 2008 +0000
@@ -153,11 +153,12 @@
             raise VMMDomainException(("Domain doesn't exist yet.",
                 ERR.NO_SUCH_DOMAIN))
 
-    def updateTransport(self, transport):
+    def updateTransport(self, transport, force = False):
         """Sets a new transport for the domain.
 
         Keyword arguments:
         transport -- the new transport (str)
+        force -- True/False force new transport for all accounts (bool)
         """
         if self._id > 0:
             trsp = Transport(self._dbh, transport=transport)
@@ -166,6 +167,11 @@
                     self._id)
             if dbc.rowcount > 0:
                 self._dbh.commit()
+            if force:
+                dbc.execute("UPDATE users SET tid=%s WHERE gid=%s",
+                        trsp.getID(), self._id)
+                if dbc.rowcount > 0:
+                    self._dbh.commit()
             dbc.close()
         else:
             raise VMMDomainException(("Domain doesn't exist yet.",