Esempio n. 1
0
    def set_advanced_setting(self, request):
        try:
            contentRaw = request.get_post_data()
            contentDecoded = contentRaw.decode("utf-8")
            contentDecoded = urllib.parse.unquote_plus(contentDecoded)
            kwargs = {
                str(x[0]): str(x[1])
                for x in (i.split("=", 1) for i in contentDecoded.split("&"))
            }

            params = json.loads(kwargs["kbxMethodParam"])
            params = {
                str(param["kbxParamName"]): param.get("kbxParamCurrentValue",
                                                      None)
                for param in params
            }
            params["kbxMethodId"] = int(kwargs["kbxMethodId"])

            returnStr = SharedMethod.call_by_method_id(**params)
            self.send_response(returnStr, request.requestId)
        except SystemException as se:
            self.send_response(se.value, request.requestId,
                               se.value["returnValue"],
                               se.value["returnMessage"])
        except Exception as e:
            self.send_response({"error": str(e)}, request.requestId, 1001)
Esempio n. 2
0
 def set_advanced_setting(self, request):
     try:
         contentRaw = request.get_post_data()
         contentDecoded = contentRaw.decode("utf-8")
         contentDecoded = urllib.parse.unquote_plus(contentDecoded)
         kwargs = {str(x[0]):str(x[1]) for x in (i.split("=", 1) for i in contentDecoded.split("&"))}
         
         params = json.loads(kwargs["kbxMethodParam"])
         params = {str(param["kbxParamName"]):param.get("kbxParamCurrentValue", None) for param in params}
         params["kbxMethodId"] = int(kwargs["kbxMethodId"])
         
         returnStr = SharedMethod.call_by_method_id(**params)
         self.send_response(returnStr, request.requestId)
     except SystemException as se:
         self.send_response(se.value, request.requestId, se.value["returnValue"], se.value["returnMessage"])
     except Exception as e:
         self.send_response({"error":str(e)}, request.requestId, 1001)
Esempio n. 3
0
    def __retry_seri_implementation(self, serId, serisWithError, seriIndexes):
        try:
            # Update statuses of all items to be retried to "busy".
            self.__serController.update_seri_status(serId=serId, seriIndexes=seriIndexes, seriStatus="busy", seriError=None)
            
            # Broadcast event.
            self.__broadcast_message__seri_retry_started(serId, seriIndexes=seriIndexes)
            
            # Retry process starts here.
            for seri in serisWithError:
                try:
                    kbxMethodId = seri["kbxMethodId"]
                    if kbxMethodId != -291: # Skips all -291 and declare as "ok" immediately.
                        params = {kbxMethodParam["kbxParamName"]:kbxMethodParam["kbxParamCurrentValue"] 
                                  for kbxMethodParam in seri["kbxMethodParams"]}
                        result = SharedMethod.call_by_method_id(kbxMethodId, **params)
                        seriError = str(result)
                    else:
                        seriError = None
                    
                    seriStatus = "ok"
                    
                except Exception as e:
                    seriStatus = "error"
                    seriError = str(e)
                    
                finally:
                    seriIndex = seri["seriIndex"]
                    
                    if not self.__serLock.is_deleted(serId):
                        # Update statuses and broadcast events only if ser is not deleted.
                        self.__serController.update_seri_status(serId=serId, seriIndexes=[seriIndex], 
                                                                seriStatus=seriStatus, seriError=seriError)
                        self.__broadcast_message__seri_retry_completed(serId, seriIndex, seriStatus, seriError)
                    
        except Exception as e:
            ''' THIS PORTION SHOULD NEVER RUN. (it's bug if this portion is executed) '''
            Logger.log_error("SceneExecutionResultService.retry_scene_execution_result_item ex:", e)

        finally:
            self.__serLock.unlock(serId)