def instrument_pyramid_config_views(module): # Location of the ViewDeriver class changed from pyramid.config to # pyramid.config.views so check if present before trying to update. if hasattr(module, 'ViewDeriver'): wrap_out_function(module, 'ViewDeriver.__call__', wrap_view_handler) if hasattr(module, 'DefaultViewMapper'): module.DefaultViewMapper.map_class_requestonly = wrap_callable( module.DefaultViewMapper.map_class_requestonly, default_view_mapper_wrapper) module.DefaultViewMapper.map_class_native = wrap_callable( module.DefaultViewMapper.map_class_native, default_view_mapper_wrapper)
def wrap_view_handler(mapped_view): return wrap_callable(mapped_view, view_handler_wrapper)