Add signals for token creation and update

Review Request #9275 - Created Oct. 17, 2017 and submitted

Barret Rennie
Djblets
release-0.10.x
9258
0488c6b...
djblets

We now emit a signal (djblets.webapi.signals.webapi_token_created)
when we generate a token via WebAPITokens.objects.generate_token()
method. In addition, this method now takes an auto_generated parameter
to indicate whether or not the created token is being automatically
generated by some process (such as an integration). This can be used by
signal consumers to determine, e.g., whether or not an e-mail should be
sent upon token generation.

Ran /r/9285/ unit tests.

  • 0
  • 0
  • 6
  • 0
  • 6
Description From Last Updated
David Trowbridge
  1. Ship It!
  2. 
      
Christian Hammond
  1. 
      
  2. This needs unit tests in Djblets.

  3. 
      
Barret Rennie
Review request changed

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

Barret Rennie
Christian Hammond
  1. 
      
  2. Why are the .version files added? They shouldn't be needed (and are unrelated to this change).

  3. djblets/webapi/tests/test_signals.py (Diff revision 3)
     
     
     
     

    Seems auto_generated can live in the function definition.

    Also, signal handlers don't need to take *args.

    These apply below as well.

  4. 
      
Barret Rennie
David Trowbridge
  1. 
      
  2. djblets/webapi/tests/test_signals.py (Diff revision 4)
     
     
     
     

    testing before webapi

  3. 
      
Christian Hammond
  1. Looks good, aside from David's comment. I just have a small doc suggestion.

  2. djblets/webapi/managers.py (Diff revision 4)
     
     

    Mind updating this to say it doesn't impact token generation but instead is passed on to the signal?

  3. 
      
Barret Rennie
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.10.x (fb3c77e)
Loading...