Date and time types not working

Bug #1575287 reported by poofeg on 2016-04-26
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

There is exception on call soap method with time:

Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/ladon/types/", line 63, in from_unicode_string
    val = typ(val)
TypeError: an integer is required (got type str)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/ladon/server/", line 168, in dispatch_request
    result = self.call_method(method,req_dict,tc,export_dict,log_line)
  File "/usr/lib/python3.4/site-packages/ladon/server/", line 86, in call_method
    args += [tc.from_unicode_string(val,arg['type'])]
  File "/usr/lib/python3.4/site-packages/ladon/types/", line 70, in from_unicode_string
    raise FromUnicodeConversionError(typ,str(e),attr_name=attr_name)
ladon.exceptions.types.FromUnicodeConversionError: Failed to convert from unicode string to Ladon supported type: <class ''>
While handling attribute: Nonean integer is required (got type str)

Processing incoming argument: "update_time"

This fix problem:
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 import sys
+import datetime
 from ladon.exceptions.types import *
 from ladon.compat import PORTABLE_BYTES,PORTABLE_STRING,pytype_support,safe_conversions

@@ -59,6 +60,10 @@
                        if typ==bool and (val[0].upper()==PORTABLE_STRING('F') or val.strip()=='0'):
                                val = False
+ elif typ==datetime.time:
+ val = datetime.datetime.strptime(val, '%H:%M:%S').time()
+ elif
+ val = datetime.datetime.strptime(val, '%Y-%m-%d').date()
                                val = typ(val)
                        # Run incoming filters aka. incoming postfilters

poofeg (poofeg) wrote :

Fix with isodate module.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers