mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Make plugin dependencies optional by allowing plugins to report errors
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from pretix.base.plugins import PluginType
|
||||
|
||||
@@ -17,5 +18,13 @@ class PaypalApp(AppConfig):
|
||||
def ready(self):
|
||||
from . import signals # NOQA
|
||||
|
||||
@cached_property
|
||||
def compatibility_errors(self):
|
||||
errs = []
|
||||
try:
|
||||
import paypalrestsdk
|
||||
except ImportError:
|
||||
errs.append("Python package 'paypalrestsdk' is not installed.")
|
||||
return errs
|
||||
|
||||
default_app_config = 'pretix.plugins.paypal.PaypalApp'
|
||||
|
||||
@@ -2,9 +2,8 @@ from django.dispatch import receiver
|
||||
|
||||
from pretix.base.signals import register_payment_providers
|
||||
|
||||
from .payment import Paypal
|
||||
|
||||
|
||||
@receiver(register_payment_providers)
|
||||
def register_payment_provider(sender, **kwargs):
|
||||
from .payment import Paypal
|
||||
return Paypal
|
||||
|
||||
Reference in New Issue
Block a user