Opened 3 years ago

Closed 3 months ago

# Variable user' does not exist (api.py around lines 410~420)

Reported by: Owned by: Pierre-Yves Strub Steffen Hoffmann normal AccountManagerPlugin normal 0.11

### Description

See attached patch for a fix.

### comment:1 follow-ups:  2  3 Changed 3 years ago by Steffen Hoffmann

Resolution: → invalid new → closed 1.0 → 0.11

Why does your patch try to fix something, that is not broken?

In fact, neither does current trunk code contain the old line referenced in your patch nor does that line even exist in current stable (0.4.3). AFAIKS the relevant code has been put in place with revision [13290] - almost three months ago, too late for last stable release - and has never been changed so far. You must be looking at a side-effect of local modifications to your copy of the source, if you see need for the proposed fix.

I cannot see another explanation, sorry. Proof me wrong, if you can, but you'll need to tell me exactly where to apply the fix too.

Anyway, I'd be even more interested in what and why you change the API source, so that we could probably learn something for the official development branch.?

### comment:2 in reply to:  1 Changed 3 years ago by Pierre-Yves Strub

The patch has been done w.r.t trunk, in this case:

If trunk is not the head of your dev., could you tell me were the current development of the plugin takes place? Otherwise, line 419 is the exact line number. I indeed have local modifications, but the patch applies without any fuzziness on a fresh checkout of trunk.

To reproduce, on an unmodified trunk, take any password store that raises an exception in IPasswordStore.set_password before having creating the user. (The htpassword backend with a read-only password file will do it) Go to the administration panel for creating a user. At creation, you'll end with the following exception:

Trac detected an internal error:
NameError: global name 'user' is not def

File "/home/strub/Projects/Trac/trac-env/local/lib/python2.7/site-packages/trac/web/main.py", line 497, in _dispatch_request
File "/home/strub/Projects/Trac/trac-env/local/lib/python2.7/site-packages/trac/web/main.py", line 214, in dispatch
File "/home/strub/Projects/Trac/trac-env/local/lib/python2.7/site-packages/trac/admin/web_ui.py", line 125, in process_request
File "build/bdist.linux-i686/egg/acct_mgr/admin.py", line 865, in _do_users
File "build/bdist.linux-i686/egg/acct_mgr/api.py", line 389, in validate_account
File "build/bdist.linux-i686/egg/acct_mgr/api.py", line 419, in _create_user


Regarding your last question, I'm currently defining some new interfaces s.t. users can record some credential payloads that can then be used by other plugins for authentication.

Version 0, edited 3 years ago by Pierre-Yves Strub (next)

### comment:3 in reply to:  1 ; follow-up:  4 Changed 3 years ago by Ryan J Ollos

In fact, neither does current trunk code contain the old line referenced in your patch nor does that line even exist in current stable (0.4.3).

You may want to take another look. Unless my mind is completely shot this evening, it looks like the patch applies directly to the lines that you point to with the TracLink.

### comment:4 in reply to:  3 Changed 3 years ago by Steffen Hoffmann

Resolution: invalid closed → reopened

You may want to take another look. Unless my mind is completely shot this evening, it looks like the patch applies directly to the lines that you point to with the TracLink.

Hm, dunno why, but I've been aiming at line 416 instead of 419, indeed. Sorry.

### comment:5 Changed 3 years ago by Steffen Hoffmann

Status: reopened → new

### comment:6 Changed 3 years ago by Steffen Hoffmann

In 13381:

AccountManagerPlugin: Correct another occurance of user to username` refs #11312.

And thanks to Pierre-Yves Strub for testing beyond current unit test harness.

### comment:7 Changed 3 years ago by Steffen Hoffmann

Well, this ticket could be closed, arguing there is no stable release out there with this bug. But let's stick to my usual habit to keep tickets open until next release, maybe for the sake of other early adopters to note the issue more easily.

### comment:8 Changed 2 years ago by Steffen Hoffmann

Status: new → accepted

### comment:9 Changed 3 months ago by Ryan J Ollos

Resolution: → fixed accepted → closed

### Modify Ticket

Action
as closed The owner will remain Steffen Hoffmann.
The resolution will be deleted. Next status will be 'reopened'.