Codebase list python-webargs / debian/4.0.0-0kali4
Fix the version comparison in patch Sophie Brun 5 years ago
3 changed file(s) with 27 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
0 python-webargs (4.0.0-0kali4) kali-dev; urgency=medium
1
2 * Fix the version comparison in patch
3
4 -- Sophie Brun <[email protected]> Wed, 24 Oct 2018 17:36:44 +0200
5
06 python-webargs (4.0.0-0kali3) kali-dev; urgency=medium
17
28 * Add a patch to handle correctly marshmallow version
2020
2121 Package: python-webargs
2222 Architecture: all
23 Depends: ${misc:Depends}, ${python:Depends}
23 Depends: ${misc:Depends}, ${python:Depends}, python-packaging
2424 Description: Python library for parsing and validating HTTP request arguments (Python 2)
2525 This package contains a Python library for parsing and validating HTTP request
2626 arguments, with built-in support for popular web frameworks, including Flask,
3030
3131 Package: python3-webargs
3232 Architecture: all
33 Depends: ${misc:Depends}, ${python3:Depends}
33 Depends: ${misc:Depends}, ${python3:Depends}, python3-packaging
3434 Description: Python library for parsing and validating HTTP request arguments (Python 3)
3535 This package contains a Python library for parsing and validating HTTP request
3636 arguments, with built-in support for popular web frameworks, including Flask,
77 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
88 --- a/webargs/core.py
99 +++ b/webargs/core.py
10 @@ -30,9 +30,7 @@ __all__ = [
10 @@ -6,6 +6,7 @@ import functools
11 import inspect
12 import logging
13 import warnings
14 +from packaging import version
15
16 try:
17 import simplejson as json
18 @@ -30,9 +31,7 @@ __all__ = [
1119 "parse_json",
1220 ]
1321
1826
1927 DEFAULT_VALIDATION_STATUS = 422
2028
21 @@ -98,7 +96,7 @@ def argmap2schema(argmap):
29 @@ -98,7 +97,7 @@ def argmap2schema(argmap):
2230 names to `Fields <marshmallow.fields.Field>`.
2331 """
2432 attrs = argmap.copy()
2533 - if MARSHMALLOW_VERSION_INFO[0] < 3:
26 + if MARSHMALLOW_VERSION_INFO < "3.0.0b7":
34 + if version.parse(MARSHMALLOW_VERSION_INFO) < version.parse("3.0.0b7"):
2735
2836 class Meta(object):
2937 strict = True
30 @@ -302,7 +300,7 @@ class Parser(object):
38 @@ -302,7 +301,7 @@ class Parser(object):
3139 argdict = schema.fields
3240 parsed = {}
3341 for argname, field_obj in iteritems(argdict):
3442 - if MARSHMALLOW_VERSION_INFO[0] < 3:
35 + if MARSHMALLOW_VERSION_INFO < "3.0.0b8":
43 + if version.parse(MARSHMALLOW_VERSION_INFO) < version.parse("3.0.0b8"):
3644 parsed_value = self.parse_arg(argname, field_obj, req, locations)
3745 # If load_from is specified on the field, try to parse from that key
3846 if parsed_value is missing and field_obj.load_from:
39 @@ -325,7 +323,7 @@ class Parser(object):
47 @@ -325,7 +324,7 @@ class Parser(object):
4048 kwargs = getattr(error, "kwargs", {})
4149 kwargs["field_names"] = error.field_names
4250 kwargs["data"] = error.data
4351 - if MARSHMALLOW_VERSION_INFO[0] < 3:
44 + if MARSHMALLOW_VERSION_INFO < "3.0.0b12":
52 + if version.parse(MARSHMALLOW_VERSION_INFO) < version.parse("3.0.0b12"):
4553 kwargs["fields"] = error.fields
4654 if "status_code" not in kwargs:
4755 kwargs["status_code"] = self.DEFAULT_VALIDATION_STATUS
48 @@ -358,7 +356,7 @@ class Parser(object):
56 @@ -358,7 +357,7 @@ class Parser(object):
4957 schema = argmap(req)
5058 else:
5159 schema = argmap2schema(argmap)()
5260 - if MARSHMALLOW_VERSION_INFO[0] < 3 and not schema.strict:
53 + if MARSHMALLOW_VERSION_INFO < "3.0.0b7" and not schema.strict:
61 + if version.parse(MARSHMALLOW_VERSION_INFO) < version.parse("3.0.0b7") and not schema.strict:
5462 warnings.warn(
5563 "It is highly recommended that you set strict=True on your schema "
5664 "so that the parser's error handler will be invoked when expected.",
57 @@ -390,7 +388,7 @@ class Parser(object):
65 @@ -390,7 +389,7 @@ class Parser(object):
5866 try:
5967 parsed = self._parse_request(schema=schema, req=req, locations=locations)
6068 result = schema.load(parsed)
6169 - data = result.data if MARSHMALLOW_VERSION_INFO[0] < 3 else result
62 + data = result.data if MARSHMALLOW_VERSION_INFO < "3.0.0b7" else result
70 + data = result.data if version.parse(MARSHMALLOW_VERSION_INFO) < version.parse("3.0.0b7") else result
6371 self._validate_arguments(data, validators)
6472 except ma.exceptions.ValidationError as error:
6573 self._on_validation_error(error, req, schema)