1. Peter Sanchez
  2. django-impersonate
  3. Pull requests

Pull requests

#6 Merged

Always add the is_impersonate attribute and set the real user as attribute

  1. Michael van Tellingen
No description
  • Learn about pull requests

Comments (3)

  1. Peter Sanchez repo owner

    1) Set the real_user attribute only if we're actually continuing with the impersonation. So in this case, add it within the "check_allow_for_user ..." block.

    2) Add a new test(s) to check for the new functionality. Should verify that real_user isn't set when we're not in impersonation mode and that it is correctly set when we are in impersonation mode.

    3) Please update the README with this new information.

    Once you've done that, update this pull request and I'll merge it in.


  2. Michael van Tellingen author

    So i've decided to change it a bit.

    the real user is now set as request.impersonator to not mess with the user object (we don't know want to overwrite the user object with various other stuff imho).

    I've also added a unittest which only tests the middelware. I think this is the way to go, the current testing infrastructure seems a bit fragile and slow. If you need some help fixing that let me know.

  3. Peter Sanchez repo owner

    Fragile? How? Also, they are a bit slow. It shouldn't take 8-10 seconds to run 15-20 tests. So if you have some improvements there, feel free.