Fix and improve loading of cached profiles in User.
Review Request #12318 — Created May 31, 2022 and submitted
User.get_profile()
attempts to cache or make use of a cached result
from a previous call. It used to make use of_profile_set_cache
, which
was the name used in Django 1.6 and 1.11. Newer versions use different
mechanisms for cache, for bothprefetch_related()
and
select_related()
. This was a regression from Review Board 4.This change fixes that support and expands upon it. A new series of unit
tests have been added that ensure caching works exactly as expected in a
variety of situations.As part of this, various datagrid unit tests have been updated to once
again have reduced query counts. These counts were initially increased
in commit ceab149f415ade7432a3ff6e625beb0cdc5645f2, thought to have been
due to middleware changes, but were actually due to the Django relation
caching changes.
Unit tests pass.
Summary | ID |
---|---|
d0f07b574c0896686d6980a02f962f2d190e3e98 |
Description | From | Last Updated |
---|---|---|
F841 local variable 'profile' is assigned to but never used |
reviewbot |