Exemple #1
0
    def processResponse(self, data, recurs):
        for packet in data:
            message = ""
            #try:
            if 1:
                if not 'OperationType' in packet:
                    packet['OperationType'] = 'Update'

                if packet['OperationType'] == 'Create':
                    raise Exception('Create is not supported')
                    compFactory.create(packet['Class'], packet['Args'])
                elif packet['OperationType'] == 'Read':
                    self.doRead(packet)
                elif packet['OperationType'] == 'Update':
                    cid = packet['ComponentId']
                    paramName = packet['ParamName']
                    newParamValue = attemptEval(str(packet['Value']))
                    currentObject = compReg.getComponent(cid)
                    self.doUpdate(cid, paramName, newParamValue, currentObject,
                                  packet['Callback'])
                    #TODO: consider adding lambda evaluation capabilities

                elif packet['OperationType'] == 'Destroy':
                    raise Exception('Destroy not supported')
                    compReg.removeComponent(packet['ComponentId'])
            try:
                print 1
            except Exception, e:
                print str(e)
                import pdb
                pdb.set_trace()
 def processResponse(self, data, recurs):
     for packet in data:
         message = ""
         #try:
         if 1:
             if not 'OperationType' in packet:
                 packet['OperationType'] = 'Update'
             
             if packet['OperationType'] == 'Create':
                 raise Exception('Create is not supported')
                 compFactory.create(packet['Class'], packet['Args'])
             elif packet['OperationType'] == 'Read':                    
                 self.doRead(packet)
             elif packet['OperationType'] == 'Update':
                 cid = packet['ComponentId']
                 paramName = packet['ParamName']
                 newParamValue = attemptEval(str(packet['Value']))
                 currentObject=compReg.getComponent(cid)
                 self.doUpdate(cid,paramName,newParamValue,currentObject,packet['Callback'])
                 #TODO: consider adding lambda evaluation capabilities
                 
             elif packet['OperationType'] == 'Destroy':
                 raise Exception('Destroy not supported')
                 compReg.removeComponent(packet['ComponentId'])
         try:
             print 1
         except Exception, e:
             print str(e)
             import pdb; pdb.set_trace()