equal
deleted
inserted
replaced
196 def delete(self): |
196 def delete(self): |
197 if self._uid > 0: |
197 if self._uid > 0: |
198 dbc = self._dbh.cursor() |
198 dbc = self._dbh.cursor() |
199 dbc.execute("DELETE FROM users WHERE gid=%s AND local_part=%s", |
199 dbc.execute("DELETE FROM users WHERE gid=%s AND local_part=%s", |
200 self._gid, self._localpart) |
200 self._gid, self._localpart) |
201 if dbc.rowcount > 0: |
201 u_rc = dbc.rowcount |
|
202 # delete also all aliases where the destination address is the same |
|
203 # as for this account. |
|
204 dbc.execute("DELETE FROM alias WHERE destination = %s", self._addr) |
|
205 if u_rc > 0 or dbc.rowcount > 0: |
202 self._dbh.commit() |
206 self._dbh.commit() |
203 dbc.close() |
207 dbc.close() |
204 else: |
208 else: |
205 raise AccE(_(u"The account »%s« doesn't exists.") % self._addr, |
209 raise AccE(_(u"The account »%s« doesn't exists.") % self._addr, |
206 ERR.NO_SUCH_ACCOUNT) |
210 ERR.NO_SUCH_ACCOUNT) |