我通过以下 HTTP 请求发出PUT
:
http://example.com/api/student?q=%7B%22filters%22:%5B%7B%22name%22:%22id%22,%22op%22:%22%3D%3D%22,%22val%22:1%7D%5D,%22disjunction%22:true%7D
其中查询字符串解码为:
q:{"filters":[{"name":"id","op":"==","val":1}],"disjunction":true}
在我的 flask-restless 代码中,我使用以下选项创建端点:
{
'model': Student,
'methods': ['GET', 'PUT', 'PATCH', 'POST', 'DELETE'],
'preprocessors': {
'POST': [pre_post_student],
'PATCH_MANY': [pre_patch_many_student]
},
'allow_patch_many': True
},
然后我定义了一个预处理器函数:
def pre_patch_many_student(search_params=None, data=None, **kw):
# Handle group management for the given students
print search_params
但是,当为上述请求调用该函数时,search_params
会出现一个空字典。
为什么?