From: Anthony Geay Date: Tue, 16 Sep 2014 08:56:02 +0000 (+0200) Subject: Correction of bug for HPContainers shared by different scripts. X-Git-Tag: V7_5_0a1~5^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=860c1d9008d3da9754088097ec64945a50bd0084;p=modules%2Fkernel.git Correction of bug for HPContainers shared by different scripts. --- diff --git a/idl/SALOME_PyNode.idl b/idl/SALOME_PyNode.idl index ba3bfaadb..5faf372ac 100644 --- a/idl/SALOME_PyNode.idl +++ b/idl/SALOME_PyNode.idl @@ -61,6 +61,13 @@ module Engines interface PyScriptNode : PyNodeBase { + /*! + This method compiles, but NOT EXECUTE, the code \a codeStr. The result of the compiled code will be used then + on execute step. + \param codeStr - the python code (without statement) to be executed, that can modify the context initialized at initialization. + */ + void assignNewCompiledCode(in string codeStr) raises (SALOME::SALOME_Exception); + /*! \brief execute a python script defined in the node \param outargsname output argument names diff --git a/src/Container/SALOME_PyNode.py b/src/Container/SALOME_PyNode.py index 9cbc8a615..07f1f7bae 100644 --- a/src/Container/SALOME_PyNode.py +++ b/src/Container/SALOME_PyNode.py @@ -106,6 +106,13 @@ class PyScriptNode_i (Engines__POA.PyScriptNode,Generic): except: raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"","PyScriptNode (%s) : code to be executed \"%s\"" %(self.nodeName,code),0)) + def assignNewCompiledCode(self,codeStr): + try: + self.code=codeStr + self.ccode=compile(codeStr,self.nodeName,'exec') + except: + raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"","PyScriptNode.assignNewCompiledCode (%s) : code to be executed \"%s\"" %(self.nodeName,codeStr),0)) + def execute(self,outargsname,argsin): """Execute the script stored in attribute ccode with pickled args (argsin)""" try: