Dennis Plöger has proposed merging lp:~j-launchpad-dennis/ladon/xsddatetime into lp:ladon.
Requested reviews: Ladon Developer (ladon-dev-team) For more details, see: https://code.launchpad.net/~j-launchpad-dennis/ladon/xsddatetime/+merge/190078 Add support for xsd:DateTime in SOAP-requests -- https://code.launchpad.net/~j-launchpad-dennis/ladon/xsddatetime/+merge/190078 Your team Ladon Developer is requested to review the proposed merge of lp:~j-launchpad-dennis/ladon/xsddatetime into lp:ladon.
=== modified file 'frameworks/python/src/ladon/compat.py' --- frameworks/python/src/ladon/compat.py 2011-08-22 00:44:05 +0000 +++ frameworks/python/src/ladon/compat.py 2013-10-09 10:19:56 +0000 @@ -1,5 +1,6 @@ import sys from ladon.types.attachment import attachment +from datetime import datetime if sys.version_info[0]==2: import StringIO,cStringIO @@ -27,7 +28,8 @@ unicode: 'string', bool: 'boolean', float: 'decimal', - attachment: 'binary' + attachment: 'binary', + datetime: 'dateTime' } type_to_jsontype = { === modified file 'frameworks/python/src/ladon/types/typeconverter.py' --- frameworks/python/src/ladon/types/typeconverter.py 2012-05-04 14:43:58 +0000 +++ frameworks/python/src/ladon/types/typeconverter.py 2013-10-09 10:19:56 +0000 @@ -2,6 +2,8 @@ import sys from ladon.exceptions.types import * from ladon.compat import PORTABLE_BYTES,PORTABLE_STRING,pytype_support,safe_conversions +from datetime import dateime,tzinfo +import re class TypeConverter(object): @@ -59,6 +61,24 @@ try: if typ==bool and (val[0].upper()==PORTABLE_STRING('F') or val.strip()=='0'): val = False + elif typ==datetime: + xsd_type = re.match('(?P<year>[\d]{4})-(?P<month>[\d]{2})-(?P<day>[\d]{2})T(?P<hour>[\d]{2}):(?P<minute>[\d]{2}):(?P<second>[\d]{2})(?P<tz>Z|[+-][\d]{2}:[\d]{2})', val) + if xsd_type: + xsd_type = xsd_type.groupdict() + tz = None + if xsd_type['tz'] != 'Z': + (hours, minutes) = xsd_type['tz'].split(":") + tz = tzinfo.utcoffset(int(hours) * 60 + int(minutes)) + val = datetime( + int(xsd_type['year']), + int(xsd_type['month']), + int(xsd_type['day']), + int(xsd_type['hour']), + int(xsd_type['minute']), + int(xsd_type['second']), + 0, + tz + ) else: val = typ(val) # Run incoming filters aka. incoming postfilters
-- Mailing list: https://launchpad.net/~ladon-dev-team Post to : ladon-dev-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~ladon-dev-team More help : https://help.launchpad.net/ListHelp