Esempio n. 1
0
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.mapped_view',
                wrap_view_handler)
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 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 instrument_bottle(module):
    global module_bottle
    module_bottle = module

    framework_details = ('Bottle', getattr(module, '__version__'))

    if hasattr(module.Bottle, 'wsgi'): # version >= 0.9
        wrap_wsgi_application(module, 'Bottle.wsgi',
                framework=framework_details)
    elif hasattr(module.Bottle, '__call__'): # version < 0.9
        wrap_wsgi_application(module, 'Bottle.__call__',
                framework=framework_details)

    if (hasattr(module, 'Route') and
            hasattr(module.Route, '_make_callback')): # version >= 0.10
        wrap_out_function(module, 'Route._make_callback',
                output_wrapper_Route_make_callback)
    elif hasattr(module.Bottle, '_match'): # version >= 0.9
        wrap_out_function(module, 'Bottle._match',
                output_wrapper_Bottle_match)
    elif hasattr(module.Bottle, 'match_url'): # version < 0.9
        wrap_out_function(module, 'Bottle.match_url',
                output_wrapper_Bottle_match)

    wrap_object_attribute(module, 'Bottle.error_handler',
            proxy_Bottle_error_handler)

    if hasattr(module, 'auth_basic'):
        wrap_function_wrapper(module, 'auth_basic', wrapper_auth_basic)

    if hasattr(module, 'SimpleTemplate'):
        wrap_function_trace(module, 'SimpleTemplate.render')

    if hasattr(module, 'MakoTemplate'):
        wrap_function_trace(module, 'MakoTemplate.render')

    if hasattr(module, 'CheetahTemplate'):
        wrap_function_trace(module, 'CheetahTemplate.render')

    if hasattr(module, 'Jinja2Template'):
        wrap_function_trace(module, 'Jinja2Template.render')

    if hasattr(module, 'SimpleTALTemplate'):
        wrap_function_trace(module, 'SimpleTALTemplate.render')
Esempio n. 5
0
def instrument_bottle(module):
    global module_bottle
    module_bottle = module

    framework_details = ("Bottle", getattr(module, "__version__"))

    if hasattr(module.Bottle, "wsgi"):  # version >= 0.9
        wrap_wsgi_application(module, "Bottle.wsgi", framework=framework_details)
    elif hasattr(module.Bottle, "__call__"):  # version < 0.9
        wrap_wsgi_application(module, "Bottle.__call__", framework=framework_details)

    if hasattr(module, "Route") and hasattr(module.Route, "_make_callback"):  # version >= 0.10
        wrap_out_function(module, "Route._make_callback", output_wrapper_Route_make_callback)
    elif hasattr(module.Bottle, "_match"):  # version >= 0.9
        wrap_out_function(module, "Bottle._match", output_wrapper_Bottle_match)
    elif hasattr(module.Bottle, "match_url"):  # version < 0.9
        wrap_out_function(module, "Bottle.match_url", output_wrapper_Bottle_match)

    wrap_object_attribute(module, "Bottle.error_handler", proxy_Bottle_error_handler)

    if hasattr(module, "auth_basic"):
        wrap_function_wrapper(module, "auth_basic", wrapper_auth_basic)

    if hasattr(module, "SimpleTemplate"):
        wrap_function_trace(module, "SimpleTemplate.render")

    if hasattr(module, "MakoTemplate"):
        wrap_function_trace(module, "MakoTemplate.render")

    if hasattr(module, "CheetahTemplate"):
        wrap_function_trace(module, "CheetahTemplate.render")

    if hasattr(module, "Jinja2Template"):
        wrap_function_trace(module, "Jinja2Template.render")

    if hasattr(module, "SimpleTALTemplate"):
        wrap_function_trace(module, "SimpleTALTemplate.render")
def instrument_gunicorn_app_base(module): 
    wrap_out_function(module, 'Application.wsgi',
            _nr_wrapper_Application_wsgi_) 
Esempio n. 7
0
def instrument_gunicorn_app_base(module):
    wrap_out_function(module, 'Application.wsgi',
                      _nr_wrapper_Application_wsgi_)
Esempio n. 8
0
def instrument_gunicorn_app_base(module):
    wrap_out_function(module, 'Application.wsgi', WSGIApplicationWrapper)