-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update warning when invalid delivery is set
- Loading branch information
1 parent
294dc20
commit 77e1174
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,6 +273,25 @@ def delivery(self): | |
def delivery(self, value): | ||
if hasattr(value, 'deliver') and callable(value.deliver): | ||
self._delivery = value | ||
|
||
# deliver_sessions is _technically_ optional in that if you disable | ||
# session tracking it will never be called | ||
# this should be made mandatory in the next major release | ||
if ( | ||
hasattr(value, 'deliver_sessions') and | ||
callable(value.deliver_sessions) | ||
): | ||
parameter_names = value.deliver_sessions.__code__.co_varnames | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
imjoehaines
Author
Contributor
|
||
|
||
if 'options' not in parameter_names: | ||
warnings.warn( | ||
'delivery.deliver_sessions should accept an ' + | ||
'"options" parameter to allow for synchronous ' + | ||
'delivery, sessions may be lost when the process ' + | ||
'exits', | ||
DeprecationWarning | ||
) | ||
|
||
else: | ||
message = ('delivery should implement Delivery interface, got ' + | ||
'{0}. This will be an error in a future release.') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This line broke our mocking of bugsnag for dev:
Since
__code__
is a magic attribute, you cannot mock it out.