mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Add a few assertions
This commit is contained in:
@@ -21,6 +21,7 @@ class EventRelatedCache:
|
||||
"""
|
||||
|
||||
def __init__(self, event: Event, cache: str='default'):
|
||||
assert isinstance(event, Event)
|
||||
self.cache = caches[cache]
|
||||
self.event = event
|
||||
self.prefixkey = 'event:%s' % self.event.pk
|
||||
|
||||
@@ -2,6 +2,8 @@ import django.dispatch
|
||||
from django.apps import apps
|
||||
from django.dispatch.dispatcher import NO_RECEIVERS
|
||||
|
||||
from tixlbase.models import Event
|
||||
|
||||
|
||||
class EventPluginSignal(django.dispatch.Signal):
|
||||
"""
|
||||
@@ -17,6 +19,8 @@ class EventPluginSignal(django.dispatch.Signal):
|
||||
|
||||
sender is required to be an instance of ``tixlbase.models.Event``.
|
||||
"""
|
||||
assert isinstance(sender, Event)
|
||||
|
||||
responses = []
|
||||
if not self.receivers or self.sender_receivers_cache.get(sender) is NO_RECEIVERS:
|
||||
return responses
|
||||
|
||||
@@ -258,6 +258,7 @@ class VariationsField(forms.ModelMultipleChoiceField):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def set_item(self, item: Item):
|
||||
assert isinstance(item, Item)
|
||||
self.item = item
|
||||
self._set_choices(self._get_choices())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user