'Try to decode string data into their original type
@param field: the Field instance
@param value: the stringified value
@todo: replace this by ordinary decoder'

@staticmethod
def _decode_data(field, value):

    if ((field.type == 'string') or (field.type == 'string') or (field.type == 'password') or (field.type == 'upload') or (field.type == 'text')):
        return value
    elif ((field.type == 'integer') or (field.type == 'id')):
        return int(value)
    elif ((field.type == 'double') or (field.type == 'decimal')):
        return float(value)
    elif (field.type == 'boolean'):
        if (value and (not (str(value)[:1].upper() in ['F', '0']))):
            return 'T'
        else:
            return 'F'
    elif (field.type == 'date'):
        return value
    elif (field.type == 'time'):
        return value
    elif (field.type == 'datetime'):
        return value
    else:
        return value
