Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#10026 closed (worksforme)

Possible error in django.contrib.auth.views.password_reset_confirm

Reported by: Jason Mayfield Owned by: nobody
Component: contrib.auth Version: master
Severity: Keywords: password reset
Cc: jwmayfield@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Was getting this error:

[Django] Error (EXTERNAL IP): /reset/a6-29j-f7bb4a0b3867c9d3024a/

Traceback (most recent call last):

 File "/usr/local/src/django/django/core/handlers/", line 86, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/usr/local/src/django/django/contrib/auth/", line 122, in password_reset_confirm
   context_instance['validlink'] = True

 File "/usr/local/src/django/django/template/", line 36, in __setitem__
   self.dicts[0][key] = value

TypeError: 'str' object does not support item assignment

Quick and dirty fix attached.

Attachments (2)

confirm.diff (479 bytes) - added by Jason Mayfield 10 years ago.
django_contrib_auth_views.diff (1.4 KB) - added by Jason Mayfield 10 years ago.

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by Jason Mayfield

Attachment: confirm.diff added

comment:1 Changed 10 years ago by Jacob

milestone: 1.1
Triage Stage: UnreviewedAccepted

In the future, please generate patches from the root of the SVN tree. There are 22 files in the Django tree named "", and without knowing to which one this patch applies it took a bit of time to figure out what you were trying to fix here.

I'm also fairly sure this patch just papers over the problem and doesn't get to the root cause. Can you share more details about your setup to help us reproduce this?

comment:2 in reply to:  1 Changed 10 years ago by Jason Mayfield

Cc: jwmayfield@… added

Sorry about the patch. I ended up using something slightly different, because even my papering over the problem didn't work long-term.

This is the first time I'd used the password reset function in 1.0 (this particular install is on rev 9843), and the password_reset_confirm view threw the error referenced above, that 'str' doesn't support item assignment. I didn't have time for deep debugging so ended up changing the function like the new attached diff.

Changed 10 years ago by Jason Mayfield

comment:3 Changed 10 years ago by Jason Mayfield

Resolution: worksforme
Status: newclosed

Appears to be working correctly now. I don't know what exact revision I may have been on when the error happened in the first place. Next time I'll do better analysis before submitting the bug report.

comment:4 Changed 8 years ago by Tom von Schwerdtner

In case anyone stumbles into this error, this can happen if one of your context processors mistakenly returns a string.

comment:5 Changed 7 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top