mirror of https://gitlab.com/tildes/tildes.git
Browse Source
Un-pin and update Marshmallow and webargs
Un-pin and update Marshmallow and webargs
As expected, these updates ended up requiring quite a few changes. I was initially going to update only Marshmallow, but the older version of webargs couldn't work with an updated Marshmallow, so I ended up needing to do both at the same time. The main changes required were: * Schemas don't need to be specified as "strict" any more, so that could be removed from constructors and Meta classes. * .validate() now returns a dict of errors (if any) instead of raising a ValidationError if anything goes wrong. This meant that I either need to check the returned dict, or switch to .load() to still get raised errors. * Marshmallow doesn't support loading from two different field names as easily (and changed the name of that to data_key), so all the routes using "group_path" needed to be changed to just "path". * Some of the Field methods and some decorated schema ones like @pre_load receive new arguments and needed to be updated to handle them and/or pass them on. * webargs will no longer send a keyword argument for any fields that aren't specified and don't have a default value when using @use_kwargs. Because of this, I added missing= values for most optional fields, but still required some special treatment for the order query variable in a couple of topic listing views. And finally, there is some strange behavior in webargs by default when a form doesn't send any data for a field (due to the input not being included or similar). When it doesn't find the field in form data, it tries to fall back to checking for JSON data, but then crashes because the request doesn't have any JSON data attached. I had to specify only to look in the form data in a few places to fix this, but I've also registered an issue against webargs related to it: https://github.com/marshmallow-code/webargs/issues/444merge-requests/87/merge
Deimos
5 years ago
39 changed files with 216 additions and 190 deletions
-
4tildes/requirements-dev.txt
-
4tildes/requirements.in
-
4tildes/requirements.txt
-
6tildes/tests/test_markdown_field.py
-
4tildes/tests/test_simplestring_field.py
-
16tildes/tests/test_title.py
-
6tildes/tests/test_user.py
-
2tildes/tildes/models/database_model.py
-
2tildes/tildes/models/user/user.py
-
6tildes/tildes/resources/group.py
-
4tildes/tildes/resources/topic.py
-
8tildes/tildes/routes.py
-
11tildes/tildes/schemas/comment.py
-
42tildes/tildes/schemas/fields.py
-
30tildes/tildes/schemas/group.py
-
5tildes/tildes/schemas/group_wiki_page.py
-
35tildes/tildes/schemas/listing.py
-
10tildes/tildes/schemas/message.py
-
20tildes/tildes/schemas/topic.py
-
31tildes/tildes/schemas/user.py
-
4tildes/tildes/templates/group_wiki.jinja2
-
12tildes/tildes/templates/group_wiki_page.jinja2
-
4tildes/tildes/templates/intercooler/topic_group_edit.jinja2
-
4tildes/tildes/templates/macros/groups.jinja2
-
6tildes/tildes/templates/topic_listing.jinja2
-
2tildes/tildes/views/api/v0/group.py
-
2tildes/tildes/views/api/v0/topic.py
-
5tildes/tildes/views/api/web/comment.py
-
9tildes/tildes/views/api/web/group.py
-
4tildes/tildes/views/api/web/topic.py
-
11tildes/tildes/views/api/web/user.py
-
10tildes/tildes/views/bookmarks.py
-
4tildes/tildes/views/exceptions.py
-
4tildes/tildes/views/group_wiki_page.py
-
2tildes/tildes/views/login.py
-
4tildes/tildes/views/notifications.py
-
47tildes/tildes/views/topic.py
-
12tildes/tildes/views/user.py
-
10tildes/tildes/views/votes.py
Write
Preview
Loading…
Cancel
Save
Reference in new issue