﻿id	summary	reporter	owner	description	type	status	priority	component	severity	resolution	keywords	cc	release
8936	Cannot delete user using AccountModule from web_ui	voithos	hasienda	"Running trac 0.12.2, with AccountManagerPlugin 0.3dev-r10371. When trying to delete a user (after logging in) using the web_ui interface, it gives the error:

{{{
Traceback (most recent call last):
  File ""c:\docume~1\voithos\locals~1\temp\easy_install-b06q5m\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py"", line 511, in _dispatch_request
    dispatcher.dispatch(req)
  File ""c:\docume~1\voithos\locals~1\temp\easy_install-b06q5m\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py"", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File ""c:\docume~1\voithos\locals~1\temp\easy_install-b06q5m\Trac-0.12.2-py2.6-win32.egg.tmp\trac\prefs\web_ui.py"", line 77, in process_request
    template, data = chosen_provider.render_preference_panel(req, panel_id)
  File ""build\bdist.win32\egg\acct_mgr\web_ui.py"", line 223, in render_preference_panel
    data = {'account': self._do_account(req)}
  File ""build\bdist.win32\egg\acct_mgr\web_ui.py"", line 290, in _do_account
    data.update(self._do_delete(req))
  File ""build\bdist.win32\egg\acct_mgr\web_ui.py"", line 363, in _do_delete
    acctmgr.delete_user(user)
NameError: global name 'acctmgr' is not defined
}}}

Traced it back to a missing `self` when calling a function in `acctmgr` in web_ui.py. From that point on, it no longer gave an error, but it would delete all of the records correctly. When looking at the database, the email record in `session_attribute` still existed, as did the user's record in `session`.

Finally managed to fix it by setting the `key` along with the `table` name before passing the SQL to `cursor.execute()`."	defect	closed	normal	AccountManagerPlugin	normal	fixed	db web_ui		0.12
