code style

This commit is contained in:
Mira Weller
2024-09-03 12:06:18 +02:00
parent 204bc84e85
commit 47b84c06b0
8 changed files with 29 additions and 16 deletions

View File

@@ -22,8 +22,10 @@ log_entry_types = LogEntryTypeRegistry({'action_type': lambda o: getattr(o, 'act
class LogEntryType:
def __init__(self, action_type=None, plain=None):
assert self.__module__ != LogEntryType.__module__ # must not instantiate base classes, only derived ones
if action_type: self.action_type = action_type
if plain: self.plain = plain
if action_type:
self.action_type = action_type
if plain:
self.plain = plain
def display(self, logentry):
if hasattr(self, 'plain'):

View File

@@ -43,7 +43,7 @@ from django.utils.functional import cached_property
from django.utils.translation import gettext_lazy as _
from pretix.base.logentrytypes import log_entry_types
from pretix.base.signals import logentry_object_link, is_app_active
from pretix.base.signals import is_app_active, logentry_object_link
class VisibleOnlyManager(models.Manager):
@@ -56,7 +56,10 @@ def make_link(a_map, wrapper, is_active=True, event=None, plugin_name=None):
if is_active:
a_map['val'] = '<a href="{href}">{val}</a>'.format_map(a_map)
elif event and plugin_name:
a_map['val'] = '<i>{val}</i> <a href="{plugin_href}"><span data-toggle="tooltip" title="{errmes}" class="fa fa-warning fa-fw"></span></a>'.format_map({
a_map['val'] = (
'<i>{val}</i> <a href="{plugin_href}">'
'<span data-toggle="tooltip" title="{errmes}" class="fa fa-warning fa-fw"></span></a>'
).format_map({
**a_map,
"errmes": _("The relevant plugin is currently not active. To activate it, click here to go to the plugin settings."),
"plugin_href": reverse('control:event.settings.plugins', kwargs={
@@ -152,8 +155,7 @@ class LogEntry(models.Model):
@cached_property
def display_object(self):
from . import (
Discount, Event, Item, Order, Question, Quota,
SubEvent, Voucher,
Discount, Event, Item, Order, Question, Quota, SubEvent, Voucher,
)
log_entry_type, meta = log_entry_types.find(action_type=self.action_type)

View File

@@ -33,7 +33,7 @@
# License for the specific language governing permissions and limitations under the License.
import warnings
from typing import Any, Callable, List, Tuple, Optional
from typing import Any, Callable, List, Tuple
import django.dispatch
from django.apps import apps

View File

@@ -47,14 +47,19 @@ from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _, pgettext_lazy
from i18nfield.strings import LazyI18nString
from pretix.base.logentrytypes import (
DiscountLogEntryType, EventLogEntryType, ItemCategoryLogEntryType,
ItemLogEntryType, LogEntryType, OrderLogEntryType, QuestionLogEntryType,
QuotaLogEntryType, TaxRuleLogEntryType, VoucherLogEntryType,
log_entry_types,
)
from pretix.base.models import (
Checkin, CheckinList, Event, ItemVariation, LogEntry, OrderPosition,
TaxRule,
)
from pretix.base.logentrytypes import log_entry_types, LogEntryType, EventLogEntryType, OrderLogEntryType, \
VoucherLogEntryType, ItemLogEntryType, QuotaLogEntryType, DiscountLogEntryType, ItemCategoryLogEntryType, \
QuestionLogEntryType, TaxRuleLogEntryType
from pretix.base.signals import logentry_display, orderposition_blocked_display, app_cache
from pretix.base.signals import (
app_cache, logentry_display, orderposition_blocked_display,
)
from pretix.base.templatetags.money import money_filter
OVERVIEW_BANLIST = [
@@ -771,7 +776,7 @@ class VariationLogEntryType(ItemLogEntryType):
'pretix.event.order.refund.canceled': _('Refund {local_id} has been canceled.'),
'pretix.event.order.refund.failed': _('Refund {local_id} has failed.'),
})
class CoreOrderLogEntryType(OrderLogEntryType):
class CoreOrderPaymentLogEntryType(OrderLogEntryType):
pass

View File

@@ -28,8 +28,8 @@ from django.template.loader import get_template
from django.urls import resolve, reverse
from django.utils.translation import gettext_lazy as _
from pretix.base.logentrytypes import EventLogEntryType, log_entry_types
from pretix.base.models import Event, Order
from pretix.base.logentrytypes import log_entry_types, EventLogEntryType
from pretix.base.signals import (
event_copy_data, item_copy_data, register_data_exporters,
)

View File

@@ -25,10 +25,12 @@ from django.urls import resolve, reverse
from django.utils.translation import gettext_lazy as _, gettext_noop
from i18nfield.strings import LazyI18nString
from ...base.logentrytypes import log_entry_types, OrderLogEntryType, ClearDataShredderMixin
from pretix.base.signals import register_payment_providers
from pretix.control.signals import html_head, nav_event, nav_organizer
from ...base.logentrytypes import (
ClearDataShredderMixin, OrderLogEntryType, log_entry_types,
)
from ...base.settings import settings_hierarkey
from .payment import BankTransfer

View File

@@ -31,8 +31,8 @@ from django.utils.crypto import get_random_string
from django.utils.translation import gettext_lazy as _, pgettext_lazy
from pretix.base.forms import SecretKeySettingsField
from pretix.base.logentrytypes import EventLogEntryType, log_entry_types
from pretix.base.middleware import _merge_csp, _parse_csp, _render_csp
from pretix.base.logentrytypes import log_entry_types, EventLogEntryType
from pretix.base.settings import settings_hierarkey
from pretix.base.signals import (
register_global_settings, register_payment_providers,

View File

@@ -46,8 +46,10 @@ from django.utils.timezone import now
from django.utils.translation import gettext_lazy as _
from django_scopes import scope, scopes_disabled
from pretix.base.logentrytypes import (
EventLogEntryType, OrderLogEntryType, log_entry_types,
)
from pretix.base.models import SubEvent
from pretix.base.logentrytypes import log_entry_types, EventLogEntryType, OrderLogEntryType
from pretix.base.signals import (
EventPluginSignal, event_copy_data, periodic_task,
)