VirtualMailManager/Account.py
changeset 17 fe9be0081e5f
parent 9 e3d3dbeb5b84
child 19 bf9a03c476fc
--- a/VirtualMailManager/Account.py	Mon Apr 14 02:21:46 2008 +0000
+++ b/VirtualMailManager/Account.py	Tue Apr 15 01:28:34 2008 +0000
@@ -120,7 +120,7 @@
             dbc = self._dbh.cursor()
             dbc.execute("""INSERT INTO users (local_part, passwd, uid, gid,\
  mid, tid) VALUES (%s, %s, %s, %s, %s, %s)""", self._localpart, self._passwd,
-                    self._uid, self._gid, self._mid, self._tid )
+                    self._uid, self._gid, self._mid, self._tid)
             self._dbh.commit()
             dbc.close()
         else:
@@ -131,12 +131,16 @@
         if self._uid == 0:
             raise VMMAccountException(("Account doesn't exists",
                 ERR.NO_SUCH_ACCOUNT))
-        if what not in ['name', 'password']:
+        if what not in ['name', 'password', 'transport']:
             return False
         dbc = self._dbh.cursor()
         if what == 'password':
             dbc.execute("UPDATE users SET passwd=%s WHERE local_part=%s AND\
  gid=%s", value, self._localpart, self._gid)
+        elif what == 'transport':
+            self._tid = Transport(self._dbh, transport=value).getID()
+            dbc.execute("UPDATE users SET tid=%s WHERE local_part=%s AND\
+ gid=%s", self._tid, self._localpart, self._gid)
         else:
             dbc.execute("UPDATE users SET name=%s WHERE local_part=%s AND\
  gid=%s", value, self._localpart, self._gid)