def convert_operation_list(ops): for op in ops: if op.vtType == 'add': AddOp.convert(op) elif op.vtType == 'change': ChangeOp.convert(op) elif op.vtType == 'delete': DeleteOp.convert(op) else: raise TypeError("Unknown operation type '%s'" % op.vtType)
def convert(_action): if _action.__class__ == Action: return _action.__class__ = Action for _annotation in _action.annotations: Annotation.convert(_annotation) for _operation in _action.operations: if _operation.vtType == 'add': AddOp.convert(_operation) elif _operation.vtType == 'change': ChangeOp.convert(_operation) elif _operation.vtType == 'delete': DeleteOp.convert(_operation) else: raise TypeError("Unknown operation type '%s'" % _operation.vtType)