Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added Signals #362

wants to merge 1 commit into from

Conversation

ZuluPro
Copy link

@ZuluPro ZuluPro commented Feb 22, 2021

Added signals for external usage:

  • pre_submit
  • post_submit
  • pre_send
  • post_send

@ZuluPro
Copy link
Author

ZuluPro commented Feb 28, 2021

Hi @jezdez, Any news ?

@ZuluPro
Copy link
Author

ZuluPro commented Mar 14, 2021

@jezdez @dokterbob ?

Copy link
Member

@jezdez jezdez left a 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)
Copy link
Member

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.

Suggested change
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
signals.post_send.send(sender=self.__class__, message=self, email=message,
signals.post_send.send(sender=self.__class__, submission=self, message=message,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants