def make_processors(**config): """ Initialize all of the text processors. You'll need to call this once before using any of the other functions in this module. >>> import fedmsg.config >>> import fedmsg.meta >>> config = fedmsg.config.load_config([], None) >>> fedmsg.meta.make_processors(**config) >>> text = fedmsg.meta.msg2repr(some_message_dict, **config) """ import pkg_resources global processors processors = [] for processor in pkg_resources.iter_entry_points('fedmsg.meta'): try: processors.append(processor.load()(_, **config)) except Exception as e: log.warn("Failed to load %r processor." % processor.name) log.exception(e) # This should always be last processors.append(DefaultProcessor(_, **config)) # By default we have three builtin processors: Default, Logger, and # Announce. If these are the only three, then we didn't find any # externally provided ones. calls to msg2subtitle and msg2link likely will # not work the way the user is expecting. if len(processors) == 3: log.warn("No fedmsg.meta plugins found. fedmsg.meta.msg2* crippled")
def make_processors(**config): """ Initialize all of the text processors. You'll need to call this once before using any of the other functions in this module. >>> import fedmsg.config >>> import fedmsg.meta >>> config = fedmsg.config.load_config([], None) >>> fedmsg.meta.make_processors(**config) >>> text = fedmsg.meta.msg2repr(some_message_dict, **config) """ import pkg_resources global processors processors = [] for processor in pkg_resources.iter_entry_points('fedmsg.meta'): try: processors.append(processor.load()(_, **config)) except Exception as e: log = logging.getLogger("fedmsg") log.warn("Failed to load %r processor." % processor.name) log.warn(str(e)) # This should always be last processors.append(DefaultProcessor(_, **config))