Modify

Opened 11 months ago

Last modified 11 months ago

#11312 new defect

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

Reported by: strub Owned by: hasienda
Priority: normal Component: AccountManagerPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

See attached patch for a fix.

Attachments (1)

0001-bug-fix-local-variable-user-does-not-exist.patch (835 bytes) - added by strub 11 months ago.

Download all attachments as: .zip

Change History (8)

comment:1 follow-ups: Changed 11 months ago by hasienda

  • Resolution set to invalid
  • Status changed from new to closed
  • Trac Release changed from 1.0 to 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 11 months ago by strub

Replying to hasienda:

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

https://trac-hacks.org/svn/accountmanagerplugin/trunk

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 231, in render_admin_panel
File "build/bdist.linux-i686/egg/acct_mgr/admin.py", line 865, in _do_users
File "build/bdist.linux-i686/egg/acct_mgr/admin.py", line 1207, in _do_add
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 11 months ago by strub (next)

comment:3 in reply to: ↑ 1 ; follow-up: Changed 11 months ago by rjollos

Replying to hasienda:

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 11 months ago by hasienda

  • Resolution invalid deleted
  • Status changed from closed to reopened

Replying to rjollos:

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 11 months ago by hasienda

  • Status changed from reopened to new

comment:6 Changed 11 months ago by hasienda

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 11 months ago by hasienda

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.

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.