IndexException whenever using PyArgParser

This kind of use case is why having the ability to treat your RPC handler and your gateway script module separately is important.

To modify my previous example to take the projectName:

class GatewayScriptModule {

	GatewayScriptModule(String projectName) {
		this.projectName = projectName
	}

	String getConfigImpl(String arg) {
        String value = // Gateway stuff using this.projectName
		return value
	}
}

class ModuleRPC {

    ModuleRPC(ClientReqSession session, String projectName) {
		this.session = session
		this.projectName = projectName
        this.gatewayScriptModule = new GatewayScriptModule(projectName)
    }

    String getConfigImpl(String arg) {
        return this.gatewayScriptModule.getConfigImpl(arg)
    }
}
1 Like