-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Signals #362
base: master
Are you sure you want to change the base?
Added Signals #362
Conversation
Hi @jezdez, Any news ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the slow review @ZuluPro, this looks good in general and just needs some tweaks for the parameter names to account for what is being passed (a submission object) to the signal callback.
Also this would need to be documented to be merged :) Thank you!
@@ -584,6 +585,7 @@ def submit(self): | |||
assert self.publish_date < now(), \ | |||
'Something smells fishy; submission time in future.' | |||
|
|||
signals.pre_submit.send(sender=self.__class__, message=self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter shouldn't be called message if the object passed isn't a message but the submission object.
signals.pre_submit.send(sender=self.__class__, message=self) | |
signals.pre_submit.send(sender=self.__class__, submission=self) |
@@ -600,6 +602,7 @@ def submit(self): | |||
finally: | |||
self.sending = False | |||
self.save() | |||
signals.post_submit.send(sender=self.__class__, message=self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signals.post_submit.send(sender=self.__class__, message=self) | |
signals.post_submit.send(sender=self.__class__, submission=self) |
@@ -635,14 +638,14 @@ def send_message(self, subscription): | |||
"text/html" | |||
) | |||
|
|||
signals.pre_send.send(sender=self.__class__, message=self, email=message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signals.pre_send.send(sender=self.__class__, message=self, email=message) | |
signals.pre_send.send(sender=self.__class__, submission=self, message=message) |
@@ -651,6 +654,9 @@ def send_message(self, subscription): | |||
{'subscription': subscription, | |||
'error': e} | |||
) | |||
error = e | |||
signals.post_send.send(sender=self.__class__, message=self, email=message, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signals.post_send.send(sender=self.__class__, message=self, email=message, | |
signals.post_send.send(sender=self.__class__, submission=self, message=message, |
Added signals for external usage: