2025-04-30 10:42:25 +00:00
committed by Git OBS Bridge
commit f07693fcb9
6 changed files with 153 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0610dcd0096b75365102d276022a22e59a1f8db8825bb0bff05e1b7194ba145d
size 58730

37
fix-test.patch Normal file
View File

@@ -0,0 +1,37 @@
From dbc37d4228bdefa858ab299517097d6e52a0b698 Mon Sep 17 00:00:00 2001
From: Kerstin Humm <kerstin@erictapen.name>
Date: Sat, 15 Feb 2025 15:47:34 +0100
Subject: [PATCH 1/2] fix test_openapi_utils
---
tests/test_openapi_utils.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Index: drf_standardized_errors-0.14.1/tests/test_openapi_utils.py
===================================================================
--- drf_standardized_errors-0.14.1.orig/tests/test_openapi_utils.py
+++ drf_standardized_errors-0.14.1/tests/test_openapi_utils.py
@@ -1,6 +1,7 @@
import sys
from unittest import mock
+import django
import pytest
from django import forms
from django.contrib.auth.models import User
@@ -515,7 +516,14 @@ def test_char_fields_with_error_codes():
assert slug.error_codes == {"invalid", "null_characters_not_allowed"}
assert regex.error_codes == {"invalid", "required", "null_characters_not_allowed"}
assert uuid.error_codes == {"invalid", "required", "null_characters_not_allowed"}
- assert ip.error_codes == {"invalid", "null_characters_not_allowed"}
+ if django.VERSION >= (4, 2):
+ assert ip.error_codes == {
+ "invalid",
+ "null_characters_not_allowed",
+ "max_length",
+ }
+ else:
+ assert ip.error_codes == {"invalid", "null_characters_not_allowed"}
class NumberForm(forms.Form):

View File

@@ -0,0 +1,5 @@
-------------------------------------------------------------------
Tue Apr 29 12:58:45 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Initial packaging (v0.14.1), needed by Weblate
- Packaged with upstream fix-test.patch to fix tests

View File

@@ -0,0 +1,84 @@
#
# spec file for package python-drf-standardized-errors
#
# 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-drf-standardized-errors
Version: 0.14.1
Release: 0
Summary: Standardize your API error responses
License: MIT
URL: https://github.com/ghazi-git/drf-standardized-errors
Source: https://files.pythonhosted.org/packages/source/d/drf-standardized-errors/drf_standardized_errors-%{version}.tar.gz
# PATCH-FIX-UPSTREAM https://github.com/ghazi-git/drf-standardized-errors/pull/96 fix test_openapi_utils
Patch: fix-test.patch
BuildRequires: python-rpm-macros
BuildRequires: %{python_module flit-core >= 3.2}
BuildRequires: %{python_module pip}
# SECTION test requirements
BuildRequires: %{python_module Django >= 3.2}
BuildRequires: %{python_module django-filter}
BuildRequires: %{python_module djangorestframework >= 3.12}
BuildRequires: %{python_module drf-spectacular >= 0.27.0}
BuildRequires: %{python_module pytest-django}
BuildRequires: %{python_module pytest}
# /SECTION
BuildRequires: fdupes
Requires: python-Django >= 3.2
Requires: python-djangorestframework >= 3.12
Suggests: python-pre-commit
Suggests: python-sphinx
Suggests: python-sphinx-autobuild
Suggests: python-sphinx_rtd_theme >= 1.1.0
Suggests: python-myst-parser
Suggests: python-flit
Suggests: python-keyring
Suggests: python-tbump
Suggests: python-drf-spectacular >= 0.27.0
Suggests: python-inflection
BuildArch: noarch
%python_subpackages
%description
# DRF Standardized Errors
Standardize your DRF API error responses.
- Highly customizable: gives you flexibility to define your own standardized error responses and override
specific aspects the exception handling process without having to rewrite everything.
- Supports nested serializers and ListSerializer errors
- Plays nicely with error monitoring tools (like Sentry, ...)
%prep
%autosetup -p1 -n drf_standardized_errors-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
export PYTHONPATH=.
export DJANGO_SETTINGS_MODULE=tests.settings
%pytest
%files %{python_files}
%{python_sitelib}/drf_standardized_errors
%{python_sitelib}/drf_standardized_errors-%{version}.dist-info
%changelog