Add signals for token creation and update

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

Information

Djblets
release-0.10.x
0488c6b...

Reviewers

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.

Description From Last Updated

This needs unit tests in Djblets.

chipx86chipx86

Why are the .version files added? They shouldn't be needed (and are unrelated to this change).

chipx86chipx86

F821 undefined name 'SignalsTests'

reviewbotreviewbot

Seems auto_generated can live in the function definition. Also, signal handlers don't need to take *args. These apply below as …

chipx86chipx86

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

chipx86chipx86

testing before webapi

daviddavid
david
  1. Ship It!
  2. 
      
chipx86
  1. 
      
  2. Show all issues

    This needs unit tests in Djblets.

  3. 
      
brennie
Review request changed

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

brennie
chipx86
  1. 
      
  2. Show all issues

    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)
     
     
     
     
    Show all issues

    Seems auto_generated can live in the function definition.

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

    These apply below as well.

  4. 
      
brennie
david
  1. 
      
  2. djblets/webapi/tests/test_signals.py (Diff revision 4)
     
     
     
     
    Show all issues

    testing before webapi

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

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

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

  3. 
      
brennie
Review request changed

Status: Closed (submitted)

Change Summary:

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