Changes between Version 2 and Version 3 of Ticket #30941


Ignore:
Timestamp:
Nov 1, 2019, 10:31:45 AM (5 years ago)
Author:
Collin Anderson
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #30941 – Description

    v2 v3  
    1 Before https://github.com/django/django/commit/2f01079, it was possible to check to see whether the lazy user has been evaluated or not using `hasattr(request, '_cached_user')`. This was undocumented, but used a lot: https://github.com/search?q=hasattr%28request%2C+%27_cached_user%27%29&type=Code
     1Before https://github.com/django/django/commit/2f01079, it was possible to check to see whether the lazy user has been evaluated or not using `hasattr(request, '_cached_user')`.
    22
    3 I think we should try to maintain backwards compatibility for that that check, and document and test it for the future. (Or if nothing else, document and test the new behavior and add a release note about the change.)
     3This was undocumented, but I think we should try to maintain backwards compatibility for that that check, and document and test it for the future. (Or if nothing else, document and test how to do this the new way and add a release note about the change.)
    44
    5 This is really helpful in middleware to be able to check this, so you can access the user if it has already been accessed, but can avoid fetching user if it hasn't already been fetched.
     5This is really helpful in middleware to be able to check whether the user has been evaluated, so you can access the user if it has already been accessed, but can avoid fetching user if it hasn't already been fetched.
Back to Top