Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Slowroll:Base:1
python-softlayer-zeep
xsd-date.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xsd-date.patch of Package python-softlayer-zeep
From d1b0257eb7b8f41bc74c0fa178e820c2d739cf30 Mon Sep 17 00:00:00 2001 From: Michael van Tellingen <m.vantellingen@labdigital.nl> Date: Wed, 16 Oct 2024 07:21:21 +0200 Subject: [PATCH] Fix regression in parsing xsd:Date with negative timezone --- CHANGES | 4 ++++ src/zeep/xsd/types/builtins.py | 12 +++++------- tests/test_xsd_builtins.py | 2 ++ 3 files changed, 11 insertions(+), 7 deletions(-) Index: softlayer-zeep-5.0.0/src/zeep/xsd/types/builtins.py =================================================================== --- softlayer-zeep-5.0.0.orig/src/zeep/xsd/types/builtins.py +++ softlayer-zeep-5.0.0/src/zeep/xsd/types/builtins.py @@ -201,6 +201,7 @@ class Time(BuiltinType): class Date(BuiltinType): _default_qname = xsd_ns("date") accepted_types = [datetime.date, str] + _pattern = re.compile(r"(\d{4})-(\d{2})-(\d{2})") @check_no_collection def xmlvalue(self, value): @@ -210,6 +211,9 @@ class Date(BuiltinType): @treat_whitespace("collapse") def pythonvalue(self, value): + m = self._pattern.match(value) + if m: + return datetime.date(*map(int, m.groups())) return isodate.parse_date(value) Index: softlayer-zeep-5.0.0/tests/test_xsd_builtins.py =================================================================== --- softlayer-zeep-5.0.0.orig/tests/test_xsd_builtins.py +++ softlayer-zeep-5.0.0/tests/test_xsd_builtins.py @@ -242,6 +242,8 @@ class TestDate: instance = builtins.Date() assert instance.pythonvalue("2016-03-04") == datetime.date(2016, 3, 4) assert instance.pythonvalue("2001-10-26+02:00") == datetime.date(2001, 10, 26) + assert instance.pythonvalue("2001-10-26-02:00") == datetime.date(2001, 10, 26) + assert instance.pythonvalue("2024-08-21-10:00") == datetime.date(2024, 8, 21) assert instance.pythonvalue("2001-10-26Z") == datetime.date(2001, 10, 26) assert instance.pythonvalue("2001-10-26+00:00") == datetime.date(2001, 10, 26) assert instance.pythonvalue("\r\n\t 2016-03-04 ") == datetime.date(2016, 3, 4)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor