Codebase list python-webargs / debian/4.0.0-0kali3
Add a patch to handle correctly marshmallow version Sophie Brun 5 years ago
3 changed file(s) with 73 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 python-webargs (4.0.0-0kali3) kali-dev; urgency=medium
1
2 * Add a patch to handle correctly marshmallow version
3
4 -- Sophie Brun <[email protected]> Tue, 28 Aug 2018 11:35:48 +0200
5
06 python-webargs (4.0.0-0kali2) kali-dev; urgency=medium
17
28 * Remove unused build-dep
0 Description: Fix check marshmallow version
1 Marshmallow has several beta releases(at least 13) with several backwards
2 incompatible changes. We have for now 3.0.0b3 in Kali. Let's be more
3 precise on the check to handle correctly the different issues with new
4 API.
5 Last-Update: 2018-08-28
6 ---
7 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
8 --- a/webargs/core.py
9 +++ b/webargs/core.py
10 @@ -30,9 +30,7 @@ __all__ = [
11 "parse_json",
12 ]
13
14 -MARSHMALLOW_VERSION_INFO = tuple(
15 - [int(part) for part in ma.__version__.split(".") if part.isdigit()]
16 -)
17 +MARSHMALLOW_VERSION_INFO = ma.__version__
18
19 DEFAULT_VALIDATION_STATUS = 422
20
21 @@ -98,7 +96,7 @@ def argmap2schema(argmap):
22 names to `Fields <marshmallow.fields.Field>`.
23 """
24 attrs = argmap.copy()
25 - if MARSHMALLOW_VERSION_INFO[0] < 3:
26 + if MARSHMALLOW_VERSION_INFO < "3.0.0b7":
27
28 class Meta(object):
29 strict = True
30 @@ -302,7 +300,7 @@ class Parser(object):
31 argdict = schema.fields
32 parsed = {}
33 for argname, field_obj in iteritems(argdict):
34 - if MARSHMALLOW_VERSION_INFO[0] < 3:
35 + if MARSHMALLOW_VERSION_INFO < "3.0.0b8":
36 parsed_value = self.parse_arg(argname, field_obj, req, locations)
37 # If load_from is specified on the field, try to parse from that key
38 if parsed_value is missing and field_obj.load_from:
39 @@ -325,7 +323,7 @@ class Parser(object):
40 kwargs = getattr(error, "kwargs", {})
41 kwargs["field_names"] = error.field_names
42 kwargs["data"] = error.data
43 - if MARSHMALLOW_VERSION_INFO[0] < 3:
44 + if MARSHMALLOW_VERSION_INFO < "3.0.0b12":
45 kwargs["fields"] = error.fields
46 if "status_code" not in kwargs:
47 kwargs["status_code"] = self.DEFAULT_VALIDATION_STATUS
48 @@ -358,7 +356,7 @@ class Parser(object):
49 schema = argmap(req)
50 else:
51 schema = argmap2schema(argmap)()
52 - if MARSHMALLOW_VERSION_INFO[0] < 3 and not schema.strict:
53 + if MARSHMALLOW_VERSION_INFO < "3.0.0b7" and not schema.strict:
54 warnings.warn(
55 "It is highly recommended that you set strict=True on your schema "
56 "so that the parser's error handler will be invoked when expected.",
57 @@ -390,7 +388,7 @@ class Parser(object):
58 try:
59 parsed = self._parse_request(schema=schema, req=req, locations=locations)
60 result = schema.load(parsed)
61 - data = result.data if MARSHMALLOW_VERSION_INFO[0] < 3 else result
62 + data = result.data if MARSHMALLOW_VERSION_INFO < "3.0.0b7" else result
63 self._validate_arguments(data, validators)
64 except ma.exceptions.ValidationError as error:
65 self._on_validation_error(error, req, schema)
0 fix-check-new-marshmallow-version.patch