from pyramid.config import Configurator from pyramid.response import Response from pyramid.view import view_config
@view_config(route_name='test')
def string_response_adaptr(request): response = Response('hello
') response.content_type = 'text/html' return response if __name__ == '__main__': config = Configurator() config.add_response_adapter(string_response_adaptr)
config_add_response_adanter(string_response_adapter)的作用:调用函数名为string_response_adaptr的函数