Add signals for token creation and update
Review Request #9275 — Created Oct. 17, 2017 and submitted
We now emit a signal (
djblets.webapi.signals.webapi_token_created
)
when we generate a token viaWebAPITokens.objects.generate_token()
method. In addition, this method now takes anauto_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. |
chipx86 | |
Why are the .version files added? They shouldn't be needed (and are unrelated to this change). |
chipx86 | |
F821 undefined name 'SignalsTests' |
reviewbot | |
Seems auto_generated can live in the function definition. Also, signal handlers don't need to take *args. These apply below as … |
chipx86 | |
Mind updating this to say it doesn't impact token generation but instead is passed on to the signal? |
chipx86 | |
testing before webapi |
david |
Change Summary:
Add unit tests.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+144 -6) |
Checks run (1 failed, 1 succeeded)
flake8
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+144 -6) |
Checks run (2 succeeded)
-
-
-
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.
Change Summary:
Cleanup according to Christian's issues
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+140 -6) |
Checks run (2 succeeded)
-
Looks good, aside from David's comment. I just have a small doc suggestion.
-
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?