[Fedora-suds-list] [Patch] bug in time parsing
Antoine Sirinelli
suds at monte-stello.com
Fri Dec 4 22:10:27 UTC 2009
Good evening,
A webservice is returning a time which cannot be read by suds. I've got the
following error:
ValueError: Invalid format "21:57:58.9559863+00:00"
The time parsing in sax/date.py assumes that there are 3 digits after the point
which is not the case.
I have applied the following change to make it works:
===================================================================
--- suds/sax/date.py (revision 618)
+++ suds/sax/date.py (working copy)
@@ -230,7 +230,10 @@
if len(part) == 1:
return (int(part[0]), None)
else:
- return (int(part[0]), int(part[1]))
+ if len(part[1]) < 4:
+ return (int(part[0]), int(part[1]))
+ else:
+ return (int(part[0]), int(part[1][:3]))
def __offset(self, s):
"""
===================================================================
I am quite sure, this configuration can produce some wrong results for exemple
if the time string has only 2 digits after the point. But I do not know if a
sub-second precision is needed.
Antoine
More information about the suds
mailing list