def _prepare_nodes(workflow, root):
 objs = serializers.deserialize('xml', etree.tostring(root))
 node = None
 nodes = []
 for obj in objs:
  obj.object.workflow = workflow
  if (type(obj.object) is Node):
   node = obj.object
  else:
   node.node_type = obj.object.node_type
   full_node = obj.object
   for (k, v) in vars(node).items():
    if ((not k.startswith('_')) and (k not in ('node_type', 'workflow', 'node_ptr_id'))):
     setattr(full_node, k, v)
   full_node.workflow = workflow
   full_node.node_type = type(full_node).node_type
   full_node.node_ptr_id = None
   full_node.id = None
   nodes.append(full_node)
 return nodes

def _prepare_nodes ( workflow , root ) : objs = serializers . deserialize ( 'xml' , etree . tostring ( root ) ) node = None nodes = [ ] for obj in objs : obj . object . workflow = workflow if ( type ( obj . object ) is Node ) : node = obj . object else : node . node_type = obj . object . node_type full_node = obj . object for ( k , v ) in vars ( node ) . items ( ) : if ( ( not k . startswith ( '_' ) ) and ( k not in ( 'node_type' , 'workflow' , 'node_ptr_id' ) ) ) : setattr ( full_node , k , v ) full_node . workflow = workflow full_node . node_type = type ( full_node ) . node_type full_node . node_ptr_id = None full_node . id = None nodes . append ( full_node ) return nodes
prepare nodes for groking by django - deserialize - automatically skip undefined nodes .