Opened 10 years ago

Closed 10 years ago

#2702 closed defect (fixed)

[patch] Subtle bug in LazyUser

Reported by: jkocherhans Owned by: Adrian Holovaty
Component: Contrib apps Version:
Severity: normal Keywords:
Cc: Maniac@…, mir@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The cached user is currently stored as an attribute of LazyUser, but should be stored as an attribute of the request. The current code behaves as if request.user were a class attribute.

Attachments (1)

lazyuser.diff (742 bytes) - added by jkocherhans 10 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 10 years ago by jkocherhans

Component: Admin interfaceContrib apps

comment:2 Changed 10 years ago by Ivan Sagalaev <Maniac@…>

Cc: Maniac@… added

Joseph, one question on a self-educational note: wouldn't it be better to check for "hasattr(request, '_cached_user')" instead of "getattr(request, '_cached_user', None) is None" ?

Changed 10 years ago by jkocherhans

Attachment: lazyuser.diff added

comment:3 Changed 10 years ago by jkocherhans

Doh! Um.. yes, it would. I knew something looked really weird about that line. Patch updated.

comment:4 Changed 10 years ago by mir@…

Cc: mir@… added

comment:5 Changed 10 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [3754]) Fixed #2702 -- Fixed LazyUser to store cache as attribute of request, not class. Thanks for the patch, jkocherhans

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