def _decision_relationships(workflow, parent, child_el):
 for switch in child_el:
  if (not isinstance(switch.tag, basestring)):
   continue
  for case in switch:
   if (not isinstance(case.tag, basestring)):
    continue
   if ('to' not in case.attrib):
    raise RuntimeError((_("Node %s has a link that is missing 'to' attribute.") % parent.name))
   to = case.attrib['to']
   try:
    child = Node.objects.get(workflow=workflow, name=to)
   except Node.DoesNotExist as e:
    raise RuntimeError((_('Node %s has not been defined.') % to))
   if (etree.QName(case).localname == 'default'):
    name = 'default'
    obj = Link.objects.create(name=name, parent=parent, child=child)
   else:
    name = 'start'
    comment = case.text.strip()
    obj = Link.objects.create(name=name, parent=parent, child=child, comment=comment)
   obj.save()

def _decision_relationships ( workflow , parent , child_el ) : for switch in child_el : if ( not isinstance ( switch . tag , basestring ) ) : continue for case in switch : if ( not isinstance ( case . tag , basestring ) ) : continue if ( 'to' not in case . attrib ) : raise RuntimeError ( ( _ ( "Node %s has a link that is missing 'to' attribute." ) % parent . name ) ) to = case . attrib [ 'to' ] try : child = Node . objects . get ( workflow = workflow , name = to ) except Node . DoesNotExist as e : raise RuntimeError ( ( _ ( 'Node %s has not been defined.' ) % to ) ) if ( etree . QName ( case ) . localname == 'default' ) : name = 'default' obj = Link . objects . create ( name = name , parent = parent , child = child ) else : name = 'start' comment = case . text . strip ( ) obj = Link . objects . create ( name = name , parent = parent , child = child , comment = comment ) obj . save ( )
resolves the switch statement like nature of decision nodes .