def route(app_or_blueprint, context=default_context, **kwargs):
    """ attach a transmute route. """
    def decorator(fn):
        fn = describe(**kwargs)(fn)
        transmute_func = TransmuteFunction(fn)
        routes, handler = create_routes_and_handler(transmute_func, context)
        for r in routes:
            # push swagger info.
            if not hasattr(app_or_blueprint, SWAGGER_ATTR_NAME):
                setattr(app_or_blueprint, SWAGGER_ATTR_NAME, SwaggerSpec())
            swagger_obj = getattr(app_or_blueprint, SWAGGER_ATTR_NAME)
            swagger_obj.add_func(transmute_func, context)
            app_or_blueprint.route(r, methods=transmute_func.methods)(handler)
        return handler
    return decorator
def route ( app_or_blueprint , context = default_context , ** kwargs ) : def decorator ( fn ) : fn = describe ( ** kwargs ) ( fn ) transmute_func = TransmuteFunction ( fn ) routes , handler = create_routes_and_handler ( transmute_func , context ) for r in routes : if not hasattr ( app_or_blueprint , SWAGGER_ATTR_NAME ) : setattr ( app_or_blueprint , SWAGGER_ATTR_NAME , SwaggerSpec ( ) ) swagger_obj = getattr ( app_or_blueprint , SWAGGER_ATTR_NAME ) swagger_obj . add_func ( transmute_func , context ) app_or_blueprint . route ( r , methods = transmute_func . methods ) ( handler ) return handler return decorator
attach a transmute route.