pyramid学习笔记整理

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('<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的函数

你可能感兴趣的:(pyramid学习笔记整理)