pyramid学习笔记整理

from pyramid.config import Configurator from pyramid.response import Response from pyramid.view import view_confightml

@view_config(route_name='test')python

<!-- lang: python -->
def string_response_adaptr(request):
      response = Response('<h1>hello</h1>')
      response.content_type = 'text/html'
      return response




<!-- lang: python -->
 if __name__ == '__main__':
      config = Configurator()
       config.add_response_adapter(string_response_adaptr)

config_add_response_adanter(string_response_adapter)的做用:调用函数名为string_response_adaptr的函数函数

相关文章
相关标签/搜索