9 def __init__(self
, type, *args
):
10 self
.cmdId
= CommandExec
.nextId
16 self
.errorHandlers
= []
18 def onOK(self
, handler
):
19 self
.okHandlers
.append(handler
)
21 def onError(self
, handler
):
22 self
.errorHandlers
.append(handler
)
27 def calledOnOK(self
, result
):
29 #print "OK: %s(%s) -> %s" % (self.type, self.args, self.result)
30 for h
in self
.okHandlers
:
31 if type(h
) is types
.FunctionType
or type(h
) is types
.MethodType
:
36 def calledOnError(self
, message
):
38 print "Error: %s(%s) -> %s" % (self
.type, self
.args
, message
)
39 for h
in self
.errorHandlers
:
40 if type(h
) is types
.FunctionType
or type(h
) is types
.MethodType
: