#
# spec file for package python-multipart
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: python-multipart
Version: 1.2.1
Release: 1.1
Summary: Parser for multipart/form-data
License: MIT
URL: https://github.com/defnull/multipart
Source: https://files.pythonhosted.org/packages/source/m/multipart/multipart-%{version}.tar.gz
BuildRequires: %{python_module flit-core >= 3.9}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
%python_subpackages
%description
This module provides multiple parsers for RFC-7578 multipart/form-data, both
low-level for framework authors and high-level for WSGI application developers:
* PushMultipartParser: A low-level incremental SansIO
(non-blocking) parser suitable for asyncio and other time or memory constrained
environments.
* MultipartParser: A streaming parser emitting memory- and disk-buffered
MultipartPart instances.
* parse_form_data: A helper function to parse both multipart/form-data
and application/x-www-form-urlencoded form submissions from a
WSGI environment.
%prep
%autosetup -p1 -n multipart-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest
%files %{python_files}
%doc README.rst
%{python_sitelib}/multipart.py
%pycache_only %{python_sitelib}/__pycache__/multipart.*.pyc
%{python_sitelib}/multipart-%{version}.dist-info
%changelog
* Fri Mar 14 2025 Felix Stegmeier
- Update to 1.2.1
* feat: Split up MultipartError into more specific exceptions and add HTTP status code hints. All exceptions are subclasses of MultipartError.
* feat: New parse_form_data(ignore_errors) parameter to throw exceptions in non-strict mode, or suppress exceptions in strict mode. Default behavior does not change (throw in strict-mode, ignore in non-strict mode).
* feat: New is_form_request(environ) helper.
* feat: New specialized content_disposition_[un]quote functions.
* feat: parse_options_header() can now use different unquote functions. The default does not change.
* fix: parse_form_data() no longer checks the request method and the new is_form_request function also ignores it. All methods can carry parse-able form data, including unknown methods. The only reliable way is to check the Content-Type header, which both functions do.
* fix: First boundary not detected if separated by chunk border.
* fix: Allow CRLF in front of first boundary, even in strict mode.
* fix: Fail fast if first boundary is broken or part of the preamble.
* fix: Fail if stream ends without finding any boundary at all.
* fix: Use modern WHATWG quoting rules for field names and filenames (#60). Legacy quoting is still supported as a fallback.
* fix: MultiDict.get(index=999) should return default value, not throw IndexError.
* build: Require Python 3.8
* Fri Nov 15 2024 Steve Kowalik
- Initial release of 1.1.0.