User.get_profile() returns cached object when database object has changed
|Reported by:||rjalves||Owned by:||nobody|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Currently there is no way to bypass the cache if we know that the cached object is going to be outdated.
For instance when using tests one may want to retrieve the user profile data in order to prepopulate a form and after posting the form data one may want to check if the alteration was successful. In this case the last call to get_profile() will return the object as it was before the post.
I therefore suggest that the attribute cached=True is added to .get_profile() such that by default the cache is used but if needed one can request .get_profile(False) or .get_profile(cached=False) to hit the database again.
Attached patch with code changes and updated unittests.
Change History (15)
comment:1 Changed 3 years ago by claudep
- Needs documentation set
- Needs tests unset
- Patch needs improvement set
- Triage Stage changed from Unreviewed to Accepted