Conversation
- Introduces two helper methods (`update_objects` and `update_object`) that can be overridden in subclasses - Makes sure `view_method` is propagated to subresources - Fixes an issue where `has_change_permission` is called after the object is updated in bulk updates - Fixes an issue where `obj.save()` is unnecessarily called after `update_object()` (which already saves) in bulk updates
@thomasst pls review |
I was initially thinking we would make the |
Yea, I hear ya, though I'd prefer to expose the validation method before we git the database. basically, it's a similar concept to what |
Some more thoughts on the validation logic:
|
@thomasst I looked into your suggestion and I don't like the outcome. I find it more confusing than the original implementation (i.e. the one from this PR). Few reasons why:
Given all of the above, I propose we move forward with this implementation. |
Okay, I agree that the purpose of the current version of Secondly, after thinking about it, I'm a bit hesitant of adding another method-specific method ( My proposals are:
|
Yea, I agree adding that extra validation method only makes things more inconsistent. Given time constrains, I'll go with not introducing any new methods. |
After giving this another look I'm seeing another important issue: One of the nice things about mongorest since its beginning has been that you could override
This now breaks on multiple levels: 1) we can't call |
I haven't fully thought it through yet, but would keeping |
I don't think that's true. Only |
Primarily to minimize the effects of a poorly constructed request.
After this change, flask-mongorest will by default limit bulk updates to 1k documents. If more than that would be affected, a 400 response is returned.
This PR also introduces a method which you can use to validate the request before processing of a bulk update starts.