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的函數函數

相關文章
相關標籤/搜索