Remove default logger on payment methods, build it based on the real class module

This commit is contained in:
Benjamin Dauvergne 2015-03-05 16:21:40 +01:00
parent 84587beaac
commit 1defd73f9b
2 changed files with 5 additions and 11 deletions

View File

@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
import logging
from common import URL, HTML
__all__ = ['Payment', 'URL', 'HTML', '__version__', 'SIPS', 'SYSTEMPAY',
@ -9,8 +7,6 @@ __all__ = ['Payment', 'URL', 'HTML', '__version__', 'SIPS', 'SYSTEMPAY',
__version__ = "0.0.22"
LOGGER = logging.getLogger(__name__)
SIPS = 'sips'
SYSTEMPAY = 'systempayv2'
SPPLUS = 'spplus'
@ -66,10 +62,9 @@ class Payment(object):
'''
def __init__(self, kind, options, logger=LOGGER):
self.logger = logger
def __init__(self, kind, options):
self.kind = kind
self.backend = get_backend(kind)(options, logger=logger)
self.backend = get_backend(kind)(options)
def request(self, amount, **kwargs):
'''Request a payment to the payment backend.

View File

@ -8,7 +8,6 @@ __all__ = ['PaymentCommon', 'URL', 'HTML', 'RANDOM', 'RECEIVED', 'ACCEPTED',
'PAID', 'ERROR']
LOGGER = logging.getLogger(__name__)
RANDOM = random.SystemRandom()
URL = 1
@ -75,9 +74,9 @@ class PaymentCommon(object):
PATH = '/tmp'
BANK_ID = '__bank_id'
def __init__(self, options, logger=LOGGER):
self.logger = logger
logger.debug('initializing with options %s' % options)
def __init__(self, options):
self.logger = logging.getLogger(self.__class__.__module__)
self.logger.debug('initializing with options %s', options)
for value in self.description['parameters']:
key = value['name']
if 'default' in value: