src/pyams_utils/adapter.py
changeset 5 930e6bc44d7d
parent 1 3f89629b9e54
child 13 e84adc865c35
equal deleted inserted replaced
4:be32c837e341 5:930e6bc44d7d
    12 
    12 
    13 __docformat__ = 'restructuredtext'
    13 __docformat__ = 'restructuredtext'
    14 
    14 
    15 
    15 
    16 # import standard library
    16 # import standard library
       
    17 import logging
       
    18 logger = logging.getLogger('PyAMS (utils)')
       
    19 
    17 import venusian
    20 import venusian
    18 
    21 
    19 # import interfaces
    22 # import interfaces
    20 
    23 
    21 # import packages
    24 # import packages
    78                     provides = intfs[0]
    81                     provides = intfs[0]
    79                 if provides is None:
    82                 if provides is None:
    80                     raise TypeError("Missing 'provided' argument")
    83                     raise TypeError("Missing 'provided' argument")
    81 
    84 
    82             config = context.config.with_package(info.module)
    85             config = context.config.with_package(info.module)
       
    86             logger.debug("Registering adapter {0} for {1} => {2}".format(str(ob),
       
    87                                                                          str(adapts),
       
    88                                                                          str(provides)))
    83             config.registry.registerAdapter(ob, adapts, provides, settings.get('name', ''))
    89             config.registry.registerAdapter(ob, adapts, provides, settings.get('name', ''))
    84 
    90 
    85         info = self.venusian.attach(wrapped, callback, category='pyams_adapter',
    91         info = self.venusian.attach(wrapped, callback, category='pyams_adapter',
    86                                     depth=depth + 1)
    92                                     depth=depth + 1)
    87 
    93