def __loadLayout(self): gLogger.info("Running loadLayout()") msg = "loadLayout() for %s@%s" % (getUsername(), getSelectedGroup()) result = self.__params2string(LOAD_LAYOUT_ARGS) if not result["OK"]: gLogger.error("Result %s: %s" % (msg, result["Message"])) return {"success": "false", "error": result["Message"]} args = result["Value"] name = args["name"] user = args["user"] group = args["group"] upc = UserProfileClient(USER_PROFILE_NAME, getRPCClient) result = upc.retrieveVarFromUser(user, group, name) gLogger.debug(result) if not result["OK"]: if result["Message"].find("No data") < 0: gLogger.error("Result %s: %s" % (msg, result["Message"])) return {"success": "false", "error": result["Message"]} err = "No data found for '%s' by %s@%s" % (name, user, group) gLogger.error("Result %s: %s" % (msg, err)) return {"success": "false", "error": err} layout = result["Value"] for i in LOAD_LAYOUT_ARGS: # Add params to layout if they are absent if not layout.has_key(i): layout[i] = args[i] result = self.__setHistory(args, "Load") history = dict() if not result["OK"]: history["Load"] = result["Message"] else: history["Load"] = result["Value"] gLogger.info("Result %s: %s AND %s" % (msg, layout, history)) return {"success": "true", "result": layout, "history": history}
def __loadLayout( self ): gLogger.info( "Running loadLayout()" ) msg = "loadLayout() for %s@%s" % ( getUsername() , getSelectedGroup() ) result = self.__params2string( LOAD_LAYOUT_ARGS ) if not result[ "OK" ]: gLogger.error( "Result %s: %s" % ( msg , result[ "Message" ] ) ) return { "success" : "false" , "error" : result[ "Message" ] } args = result[ "Value" ] name = args[ "name" ] user = args[ "user" ] group = args[ "group" ] upc = UserProfileClient( USER_PROFILE_NAME, getRPCClient ) result = upc.retrieveVarFromUser( user , group, name ) gLogger.debug( result ) if not result[ "OK" ]: if result[ "Message" ].find( "No data" ) < 0 : gLogger.error( "Result %s: %s" % ( msg , result[ "Message" ] ) ) return { "success" : "false" , "error" : result[ "Message" ] } err = "No data found for '%s' by %s@%s" % ( name , user , group ) gLogger.error( "Result %s: %s" % ( msg , err ) ) return { "success" : "false" , "error" : err } layout = result[ "Value" ] for i in LOAD_LAYOUT_ARGS : # Add params to layout if they are absent if not layout.has_key( i ): layout[ i ] = args[ i ] result = self.__setHistory( args , "Load" ) history = dict() if not result[ "OK" ]: history[ "Load" ] = result[ "Message" ] else: history[ "Load" ] = result[ "Value" ] gLogger.info( "Result %s: %s AND %s" % ( msg , layout , history ) ) return { "success" : "true" , "result" : layout , "history" : history }
def __lastUsed(self): gLogger.info("Running lastUsed()") msg = "lastUsed() for %s@%s" % (getUsername(), getSelectedGroup()) result = self.__getHistory("Load") if not result["OK"]: gLogger.error("Result %s: %s" % (msg, result["Message"])) return S_ERROR(result["Message"]) history = result["Value"] if not len(history) > 0: err = "Load history is empty" gLogger.error("Result %s: %s" % (msg, err)) return S_ERROR(err) args = history[0] name = args["name"] user = args["user"] group = args["group"] upc = UserProfileClient(USER_PROFILE_NAME, getRPCClient) result = upc.retrieveVarFromUser(user, group, name) gLogger.debug(result) if not result["OK"]: gLogger.error("Result %s: %s" % (msg, result["Message"])) return S_ERROR(result["Message"]) layout = result["Value"] for i in LOAD_LAYOUT_ARGS: # Add params to layout if they are absent if not layout.has_key(i): layout[i] = args[i] gLogger.info("Result %s: %s" % (msg, layout)) return S_OK(layout)
def __lastUsed( self ): gLogger.info( "Running lastUsed()" ) msg = "lastUsed() for %s@%s" % ( getUsername() , getSelectedGroup() ) result = self.__getHistory( "Load" ) if not result[ "OK" ]: gLogger.error( "Result %s: %s" % ( msg , result[ "Message" ] ) ) return S_ERROR( result[ "Message" ] ) history = result[ "Value" ] if not len( history ) > 0: err = "Load history is empty" gLogger.error( "Result %s: %s" % ( msg , err ) ) return S_ERROR( err ) args = history[ 0 ] name = args[ "name" ] user = args[ "user" ] group = args[ "group" ] upc = UserProfileClient( USER_PROFILE_NAME, getRPCClient ) result = upc.retrieveVarFromUser( user , group, name ) gLogger.debug( result ) if not result[ "OK" ]: gLogger.error( "Result %s: %s" % ( msg , result[ "Message" ] ) ) return S_ERROR( result[ "Message" ] ) layout = result[ "Value" ] for i in LOAD_LAYOUT_ARGS : # Add params to layout if they are absent if not layout.has_key( i ): layout[ i ] = args[ i ] gLogger.info( "Result %s: %s" % ( msg , layout ) ) return S_OK( layout )