棱锥体的注释视图映射器
rebecca.annotationmapper的Python项目详细描述
rebecca.annotationmapper是金字塔Web应用程序的viewmapper。 它处理视图参数的注释。
安装
$ pip install rebecca.annotationmapper
用法
rebecca.annotationmapper提供include fook。
config.include('rebecca.annotationmapper')
使用rebecca.annotationmapper.annotations
注释参数def hello(context, request, nane: FromMatchDict): request.response.text = "Hello, {name}".format(name=name) return request.response config.add_route("hello", "/hello/{name}") config.add_view(hello, route_name="hello")
由FromMatchDict注释的参数name是 从request.matchdict['name']到rebecca.annotationmapper.AnnotationViewMapper的给定值。
例如,您访问“http://localhost/hello/aodag”,得到消息“hello,aodag”。
注释
fromMatchDict
提供来自request.matchdict的值。
fromparam
提供来自request.params的值。
从会话
提供来自request.session的值。
fromHeader
提供来自request.headers的值。
从属性
从属性request提供值。
更改
0.1
- 首次发布