def load_handlers(config, handler_names):
 handlers = []
 if isinstance(handler_names, basestring):
  handler_names = [handler_names]
 for handler in handler_names:
  logger.debug('Loading Handler %s', handler)
  try:
   cls = load_dynamic_class(handler, Handler)
   cls_name = cls.__name__
   handler_config = configobj.ConfigObj()
   handler_config.merge(config['handlers']['default'])
   if (cls_name in config['handlers']):
    handler_config.merge(config['handlers'][cls_name])
   if ('handlers_config_path' in config['server']):
    configfile = (os.path.join(config['server']['handlers_config_path'], cls_name) + '.conf')
    if os.path.exists(configfile):
     handler_config.merge(configobj.ConfigObj(configfile))
   h = cls(handler_config)
   handlers.append(h)
  except (ImportError, SyntaxError):
   logger.warning('Failed to load handler %s. %s', handler, traceback.format_exc())
   continue
 return handlers

def load_handlers ( config , handler_names ) : handlers = [ ] if isinstance ( handler_names , basestring ) : handler_names = [ handler_names ] for handler in handler_names : logger . debug ( 'Loading Handler %s' , handler ) try : cls = load_dynamic_class ( handler , Handler ) cls_name = cls . __name__ handler_config = configobj . ConfigObj ( ) handler_config . merge ( config [ 'handlers' ] [ 'default' ] ) if ( cls_name in config [ 'handlers' ] ) : handler_config . merge ( config [ 'handlers' ] [ cls_name ] ) if ( 'handlers_config_path' in config [ 'server' ] ) : configfile = ( os . path . join ( config [ 'server' ] [ 'handlers_config_path' ] , cls_name ) + '.conf' ) if os . path . exists ( configfile ) : handler_config . merge ( configobj . ConfigObj ( configfile ) ) h = cls ( handler_config ) handlers . append ( h ) except ( ImportError , SyntaxError ) : logger . warning ( 'Failed to load handler %s. %s' , handler , traceback . format_exc ( ) ) continue return handlers
load handlers .