def _process_item(v): """This function maps sqlalchemy types to spyne types.""" rpc_type = None if isinstance(v, Column): if isinstance(v.type, sqlalchemy.Enum): if v.type.convert_unicode: rpc_type = primitive.Unicode(values=v.type.enums) else: rpc_type = primitive.String(values=v.type.enums) elif v.type in _type_map: rpc_type = _type_map[v.type] elif type(v.type) in _type_map: rpc_type = _type_map[type(v.type)] else: raise Exception("soap_type was not found. maybe _type_map needs a " "new entry. %r" % v) elif isinstance(v, RelationshipProperty): v.enable_typechecks = False # FIXME: Distinguish between *ToMany and *ToOne relationship. # rpc_type = v.argument rpc_type = Array(v.argument) return rpc_type
binary.ByteArray, sqlalchemy.LargeBinary: binary.ByteArray, sqlalchemy.Boolean: primitive.Boolean, sqlalchemy.DateTime: primitive.DateTime, sqlalchemy.Date: primitive.Date, sqlalchemy.Time: primitive.Time, sqlalchemy.orm.relation: complex.Array, UUID: primitive.String(pattern="%(x)s{8}-%(x)s{4}-%(x)s{4}-%(x)s{4}-%(x)s{12}" % {'x': '[a-fA-F0-9]'}, name='uuid') } def _process_item(v): """This function maps sqlalchemy types to spyne types.""" rpc_type = None if isinstance(v, Column): if isinstance(v.type, sqlalchemy.Enum): if v.type.convert_unicode: rpc_type = primitive.Unicode(values=v.type.enums) else: rpc_type = primitive.String(values=v.type.enums)