Skip to content

Commit

Permalink
fix delete from relation
Browse files Browse the repository at this point in the history
the if-block for deleting an object from a relation was not committing; the tests were still passing because the session was still open and the next API call would pull the object out of the session, not the DB. Put a `session.remove()` before the API call to check that the removed object is actually gone from the relation, and you'll see that it's still there in the DB.
  • Loading branch information
glyphobet committed Jun 14, 2014
1 parent cbfcb16 commit 5cfdc57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion flask_restless/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,8 +1124,8 @@ def delete(self, instid, relationname, relationinstid):
relation.remove(relation_instance)
elif inst is not None:
self.session.delete(inst)
self.session.commit()
is_deleted = True
self.session.commit()
for postprocessor in self.postprocessors['DELETE']:
postprocessor(is_deleted=is_deleted)
return {}, 204
Expand Down

0 comments on commit 5cfdc57

Please sign in to comment.