(self, node, data_type=None)
return data
Cast xml information into appropriate python type
Cast xml information into appropriate python type
Cast xml information into appropriate python type
def convertXmlValue(self, node, data_type=None):
    """Cast xml information into appropriate python type
    """
    if node is None:
      return None
    if data_type is None:
      data_type = self.getPropertyType(node)
    if data_type == NONE_TYPE:
      return None
    data = node.text
    if data is not None and isinstance(data, unicode):
      data = data.encode('utf-8')
    elif data is None and data_type in TEXT_TYPE_LIST:
      return ''
    # We can now convert string in tuple, dict, binary...
    if data_type in LIST_TYPE_LIST:
      data = unmarshaller(node[0])
    elif data_type in TEXT_TYPE_LIST:
      data = unescape(data)
    elif data_type == BOOLEAN_TYPE:
      if data == 'False':
        data = False
      elif data == 'True':
        data = True
      else:
        raise TypeError('Boolean type not expected:%r' % (data,))
    elif data_type in DATA_TYPE_LIST:
      if data is None:
        # data is splitted inside  block_data nodes
        data = ''.join([standard_b64decode(block.text) for\
                                                 block in node.iterchildren()])
    elif data_type == DATE_TYPE:
      data = DateTime(data)
    elif data_type == INT_TYPE :
      data = int(data)
    return data
def convertXmlValue ( self , node , data_type = None ) : if node is None : return None if data_type is None : data_type = self . getPropertyType ( node ) if data_type == NONE_TYPE : return None data = node . text if data is not None and isinstance ( data , unicode ) : data = data . encode ( 'utf-8' ) elif data is None and data_type in TEXT_TYPE_LIST : return '' # We can now convert string in tuple, dict, binary... if data_type in LIST_TYPE_LIST : data = unmarshaller ( node [ 0 ] ) elif data_type in TEXT_TYPE_LIST : data = unescape ( data ) elif data_type == BOOLEAN_TYPE : if data == 'False' : data = False elif data == 'True' : data = True else : raise TypeError ( 'Boolean type not expected:%r' % ( data , ) ) elif data_type in DATA_TYPE_LIST : if data is None : # data is splitted inside  block_data nodes data = '' . join ( [ standard_b64decode ( block . text ) for block in node . iterchildren ( ) ] ) elif data_type == DATE_TYPE : data = DateTime ( data ) elif data_type == INT_TYPE : data = int ( data ) return data