VirtualMailManager/Alias.py
changeset 12 44161dbb1518
parent 9 e3d3dbeb5b84
child 32 ceb700bc4a80
equal deleted inserted replaced
11:7a5bd38c5b98 12:44161dbb1518
    94         else:
    94         else:
    95             raise VMMAliasException(("Alias doesn't exists", ERR.NO_SUCH_ALIAS))
    95             raise VMMAliasException(("Alias doesn't exists", ERR.NO_SUCH_ALIAS))
    96 
    96 
    97     def delete(self):
    97     def delete(self):
    98         dbc = self._dbh.cursor()
    98         dbc = self._dbh.cursor()
    99         dbc.execute("DELETE FROM alias WHERE gid=%s AND address=%s",
    99         if self._dest is None:
   100                 self._gid, self._localpart)
   100             dbc.execute("DELETE FROM alias WHERE gid=%s AND address=%s",
       
   101                     self._gid, self._localpart)
       
   102         else:
       
   103             dbc.execute("DELETE FROM alias WHERE gid=%s AND address=%s AND \
       
   104  destination=%s", self._gid, self._localpart, self._dest)
   101         rowcount = dbc.rowcount
   105         rowcount = dbc.rowcount
   102         dbc.close()
   106         dbc.close()
   103         if rowcount > 0:
   107         if rowcount > 0:
   104             self._dbh.commit()
   108             self._dbh.commit()
   105         else:
   109         else: