Call e-mail hooks that have changed in a backwards compatible manner
Review Request #9250 — Created Oct. 6, 2017 and submitted
The
ReviewEmailHook
updated in 3.0b2 with a new argument
(to_submitter_only
). The previous hooks did not accept**kwargs
, so
calling any existing hook with this new argument will cause an Exception
(and the e-mail will not send). We are now very careful about only
passing in these new arguments when the hook supports them. Otherwise,
we will omit the argument and emit a warning that the hook should accept
**kwargs
.All hook base classes have been updated to accept
**kwargs
.
Tested with an extension that defined a ReviewEmailHook that did not
acceptto_submitter_only
. The warning was emitted and the hook did
not cause an exception
Description | From | Last Updated |
---|---|---|
F401 'django.utils.six' imported but unused |
reviewbot | |
The adding arguments bit repeats. |
chipx86 | |
You can just do kwargs.copy(). No need for the copy module. That said, you can freely modify **kwargs. No need … |
chipx86 | |
This should always warn if argspec.keywords is None. Every single e-mail hook should be updated to take **kwargs. We want … |
chipx86 | |
Rather than type(method.im_self), can you just pass in the hook instance to the method? |
chipx86 | |
This should use DeprecationWarning, rather than a custom warning. |
chipx86 |
- Commit:
-
c6376227ca49b4a30453a2d2a7fe0e385b7f9e841ca32450de409b9474c0ec5caa8c36ba68e0ee25
Checks run (2 succeeded)
-
-
-
You can just do
kwargs.copy()
. No need for thecopy
module.That said, you can freely modify
**kwargs
. No need to copy it. -
This should always warn if
argspec.keywords
isNone
. Every single e-mail hook should be updated to take**kwargs
. We want authors to update their hooks all at once, not just every time we decide to add a parameter. (New extension hook functions that might need new parameters later, like settings or computers, should probably take**kwargs
going forward so we minimize running into this.)That means the code calling this method needs to always call it. We should have a single code path going through these checks back in
filter_email_recipients_from_hooks
. -
-
- Change Summary:
-
Addressed feedback.
- Description:
-
The
ReviewEmailHook
updated in 3.0b2 with a new argument( to_submitter_only
). The previous hooks did not accept**kwargs
, socalling any existing hook with this new argument will cause an Exception (and the e-mail will not send). We are now very careful about only passing in these new arguments when the hook supports them. Otherwise, we will omit the argument and emit a warning that the hook should accept **kwargs
.+ + All hook base classes have been updated to accept
**kwargs
. - Commit:
-
1ca32450de409b9474c0ec5caa8c36ba68e0ee256ef42df276a2d2fbd02644d4d13c3f7591d10639