New signal: allow_ticket_download

This commit is contained in:
Raphael Michel
2017-10-02 15:07:23 +02:00
parent d4259501af
commit 8accaae6b1
4 changed files with 22 additions and 4 deletions

View File

@@ -35,7 +35,8 @@ from pretix.base.services.locking import LockTimeoutException
from pretix.base.services.mail import SendMailException
from pretix.base.services.pricing import get_price
from pretix.base.signals import (
order_fee_calculation, order_paid, order_placed, periodic_task,
allow_ticket_download, order_fee_calculation, order_paid, order_placed,
periodic_task,
)
from pretix.celery_app import app
from pretix.multidomain.urlreverse import build_absolute_uri
@@ -567,6 +568,9 @@ def send_download_reminders(sender, **kwargs):
if now() < reminder_date:
continue
for o in e.orders.filter(status=Order.STATUS_PAID, download_reminder_sent=False):
if not all([r for rr, r in allow_ticket_download.send(e, order=o)]):
continue
o.download_reminder_sent = True
o.save()
email_template = e.settings.mail_text_download_reminder

View File

@@ -261,3 +261,13 @@ expected to return a string or None, if you don't know about this fee.
As with all plugin signals, the ``sender`` keyword argument will contain the event.
"""
allow_ticket_download = EventPluginSignal(
providing_args=['order']
)
"""
This signal is sent out to check if tickets for an order can be downloaded. If any receiver returns false,
a download will not be offered.
As with all event-plugin signals, the ``sender`` keyword argument will contain the event.
"""