[Fedora-suds-list] [Patch] bug in time parsing

Jeff Ortel jortel at redhat.com
Mon Dec 7 17:18:44 UTC 2009


Hello Antoine

On 12/04/2009 04:10 PM, Antoine Sirinelli wrote:
> 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"

I don't think this format is valid, is it?

>
> 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
>
>
> _______________________________________________
> fedora-suds-list mailing list
> fedora-suds-list at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-suds-list

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5126 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.fedoraproject.org/pipermail/suds/attachments/20091207/6dc46074/attachment.bin 


More information about the suds mailing list