Skip to content

Commit

Permalink
look for pre/post-processors using _SINGLE and _MANY suffixes
Browse files Browse the repository at this point in the history
This code previously was looking for pre/post-processors on `PUT`, and
applying them to `PATCH`, but the correct keys are `PUT_MANY`, `PUT_SINGLE`,
`PATCH_MANY` and `PATCH_SINGLE`.
  • Loading branch information
glyphobet committed Feb 5, 2013
1 parent ba361d4 commit eb61101
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions flask_restless/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,14 @@ def __init__(self, session, model, authentication_required_for=None,
self.preprocessors['POST'].append(post_form_preprocessor)
# postprocessors for PUT are applied to PATCH because PUT is just a
# redirect to PATCH
for postprocessor in self.postprocessors['PUT']:
self.postprocessors['PATCH'].append(postprocessor)
for preprocessor in self.preprocessors['PUT']:
self.preprocessors['PATCH'].append(preprocessor)
for postprocessor in self.postprocessors['PUT_SINGLE']:
self.postprocessors['PATCH_SINGLE'].append(postprocessor)
for preprocessor in self.preprocessors['PUT_SINGLE']:
self.preprocessors['PATCH_SINGLE'].append(preprocessor)
for postprocessor in self.postprocessors['PUT_MANY']:
self.postprocessors['PATCH_MANY'].append(postprocessor)
for preprocessor in self.preprocessors['PUT_MANY']:
self.preprocessors['PATCH_MANY'].append(preprocessor)

def _add_to_relation(self, query, relationname, toadd=None):
"""Adds a new or existing related model to each model specified by
Expand Down

0 comments on commit eb61101

Please sign in to comment.