mirror of
https://github.com/lucaspalomodevelop/indico-plugins.git
synced 2026-03-16 08:44:40 +00:00
Run pyupgrade
This commit is contained in:
parent
f2eabd112b
commit
614d7369d8
@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# This file is part of the SixPay Indico EPayment Plugin.
|
||||
# Copyright (C) 2017 - 2018 Max Fischer
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# This file is part of the SixPay Indico EPayment Plugin.
|
||||
# Copyright (C) 2017 - 2018 Max Fischer
|
||||
@ -17,7 +16,6 @@
|
||||
# along with SixPay Indico EPayment Plugin;
|
||||
# if not, see <http://www.gnu.org/licenses/>.
|
||||
"""Definition of callbacks exposed by the Indico server."""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from indico.core.plugins import IndicoPluginBlueprint
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# This file is part of the SixPay Indico EPayment Plugin.
|
||||
# Copyright (C) 2017 - 2018 Max Fischer
|
||||
#
|
||||
@ -22,7 +21,6 @@ The entry point for indico is the :py:class:`~.SixpayPaymentPlugin`.
|
||||
It handles configuration via the settings forms, initiates payments
|
||||
and provides callbacks for finished payments via its blueprint.
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import requests
|
||||
from urllib.parse import urljoin
|
||||
@ -64,7 +62,7 @@ from .utility import (get_request_header, get_terminal_id, gettext, provider, sa
|
||||
# - validators: Input validation, see wtforms.validators
|
||||
# - description: help text of the field, an internationalised text
|
||||
|
||||
class FormatField(object):
|
||||
class FormatField:
|
||||
"""Validator for format fields, i.e. strings with ``{key}`` placeholders.
|
||||
|
||||
:param max_length: optional maximum length, checked on a test formatting
|
||||
@ -112,13 +110,13 @@ class FormatField(object):
|
||||
try:
|
||||
test_format = field.data.format(**self.field_map)
|
||||
except KeyError as err:
|
||||
raise ValidationError('Invalid format string key: {}'.format(err))
|
||||
raise ValidationError(f'Invalid format string key: {err}')
|
||||
except ValueError as err:
|
||||
raise ValidationError('Malformed format string: {}'.format(err))
|
||||
raise ValidationError(f'Malformed format string: {err}')
|
||||
if len(test_format) > self.max_length:
|
||||
raise ValidationError(
|
||||
'Too long format string:'
|
||||
' shortest replacement with {0}, expected {1}'
|
||||
' shortest replacement with {}, expected {}'
|
||||
.format(
|
||||
len(test_format), self.max_length
|
||||
)
|
||||
@ -301,7 +299,7 @@ class SixpayPaymentPlugin(PaymentPluginMixin, IndicoPlugin):
|
||||
'event_id': registration.event_id,
|
||||
'event_title': registration.event.title,
|
||||
'eventuser_id':
|
||||
'e{0}u{1}'.format(registration.event_id, registration.user_id),
|
||||
f'e{registration.event_id}u{registration.user_id}',
|
||||
'registration_title': registration.registration_form.title
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# This file is part of the SixPay Indico EPayment Plugin.
|
||||
# Copyright (C) 2017 - 2018 Max Fischer
|
||||
@ -17,7 +16,6 @@
|
||||
# along with SixPay Indico EPayment Plugin;
|
||||
# if not, see <http://www.gnu.org/licenses/>.
|
||||
"""Callbacks for asynchronous replies by Saferpay and to redirect the user."""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import requests
|
||||
from urllib.parse import urljoin
|
||||
@ -84,12 +82,12 @@ class SixPayResponseHandler(BaseRequestHandler):
|
||||
|
||||
def __init__(self):
|
||||
"""Initialize request handler."""
|
||||
super(SixPayResponseHandler, self).__init__()
|
||||
super().__init__()
|
||||
# registration context is not initialised before `self._process_args`
|
||||
self.sixpay_url = None # type: str
|
||||
|
||||
def _process_args(self):
|
||||
super(SixPayResponseHandler, self)._process_args()
|
||||
super()._process_args()
|
||||
self.sixpay_url = get_setting('url')
|
||||
|
||||
def _process(self):
|
||||
@ -325,7 +323,7 @@ class UserSuccessHandler(SixPayResponseHandler):
|
||||
self._process_confirmation()
|
||||
except TransactionFailure as err:
|
||||
current_plugin.logger.warning(
|
||||
'SixPay transaction failed during %s: %s' % (
|
||||
'SixPay transaction failed during {}: {}'.format(
|
||||
err.step, err.details
|
||||
)
|
||||
)
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# This file is part of the SixPay Indico EPayment Plugin.
|
||||
# Copyright (C) 2017 - 2018 Max Fischer
|
||||
@ -17,7 +16,6 @@
|
||||
# along with SixPay Indico EPayment Plugin;
|
||||
# if not, see <http://www.gnu.org/licenses/>.
|
||||
"""Utility functions used by the Sixpay payment plugin."""
|
||||
from __future__ import division, unicode_literals
|
||||
|
||||
import uuid
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user