luizhandrade / pysimplesoap

Automatically exported from code.google.com/p/pysimplesoap
0 stars 0 forks source link

XML schema 'duration' datatype #136

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is a discussion about whether and how to support the ISO 8601 "duration" 
datatype as described in http://www.w3.org/TR/xmlschema-2/#duration

Example: P3DT5H30M
This is: 3 days, 5 hours, 30 minutes, and it could be converted to a 
datetime.timedelta(days = 3, hours = 5, minutes = 30)

The problem here is that ISO 8601 also supports years and months, which are not 
supported by datetime.timedelta. This might lead to inaccurate results due to 
the different amount of days that could be represented by months and years.

Would it fit the scope of pysimplesoap to convert duration to timedelta or 
should it just output the duration as string (as pysimplesoap does now), so the 
task to convert it lies with the subsequent developer?

See attachment for example wsdl and response that I am working with.

Original issue reported on code.google.com by dirkjon...@gmail.com on 24 Feb 2014 at 11:14

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks Dirk!

Just for the record, some initial patches were applied in revision 125c0a13bec1 
but then reverted in revision 1a76eb59cdf5 due to some issues in the regex (so 
it now should be managed as an string).

With this info, I'll try to make a unit test and see if we can implement a 
workaround.

Yes, in the scope of pysimplesoap, we should convert Python's 
datetime.timedelta to xsd:duration if we could represent it correctly

Original comment by reingart@gmail.com on 24 Feb 2014 at 3:04