Exemplo n.º 1
0
 def format_action(self, action):
     if len(action) > 2 and type(action[A_N2]) == types.ListType:
         print '['+action[A_DESC]+', '+action[A_N1]+','
         xml_print(action[A_N2])
         print "]"
     elif len(action) > 2:
         print '['+action[A_DESC]+', '+action[A_N1]+', '+action[A_N2]+']'
     else:
         print '['+action[A_DESC]+', '+action[A_N1]+']'
Exemplo n.º 2
0
 def format_action(self, action):
     if action[A_DESC] == 'remove': 
         write_xupdate_node(action[A_DESC], [['select', action[A_N1]]], '  ')
     elif action[A_DESC] == 'append-last':
         open_xupdate_node('append', [['select', action[A_N1]], ['child', 'last()']], '  ')
         xml_print(action[A_N2], '    ', xupdate=1)
         close_xupdate_node('append', '  ')
     elif action[A_DESC] == 'append-first':
         open_xupdate_node('append', [['select', action[A_N1]], ['child', 'first()']], '  ')
         xml_print(action[A_N2], '    ', xupdate=1)
         close_xupdate_node('append', '  ')
     elif action[A_DESC] in ['append', 'insert-after']:
         open_xupdate_node(action[A_DESC], [['select', action[A_N1]]], '  ')
         xml_print(action[A_N2], '    ', xupdate=1)
         close_xupdate_node(action[A_DESC], '  ')
     elif action[A_DESC] == 'rename': 
         open_xupdate_node(action[A_DESC], [['name', action[A_N1]]], '  ')
         print action[A_N2]
         close_xupdate_node(action[A_DESC], '  ')
     else:
         open_xupdate_node(action[A_DESC], [['select', action[A_N1]]], '  ')
         print action[A_N2]
         close_xupdate_node(action[A_DESC], '  ')
     print