擅长:python、mysql、java
<p>当时公认的答案是正确的。然而,post和preprocessor在Flask untillet中的工作方式发生了变化。<a href="https://flask-restless.readthedocs.org/en/latest/customizing.html#request-preprocessors-and-postprocessors" rel="nofollow">According to the documentation</a>:</p>
<blockquote>
<p>The preprocessors and postprocessors for each type of request accept
different arguments, but none of them has a return value (more
specifically, any returned value is ignored). Preprocessors and
postprocessors modify their arguments in-place.</p>
</blockquote>
<p>所以现在在我的后处理器中,我只删除我不想要的任何键。例如:</p>
<pre><code>def api_post_get_many(result=None, **kw):
for key in result.keys():
if key != 'objects':
del result[key]
</code></pre>