Ignition extension system.project.update

I'm attempting to run a simple 'call route to update project' webdev module on ignition, using the ignition extensions:

I have installed the extension/confirmed it loads properly and that project update can be run from the script console.

My code for the route is below:

def doPost(request, session):
	print(str(request))
	system.project.update()
	return {'response': 'good'}

And this is giving me 500s/not logging anything.

Is there something I should be calling differently with this?

Try explicitly specifying the project.

When not specified, the function requires the current project to be defined in a ThreadLocal variable that isn't set in the context of a WebDev request handler.

so that would be 'system.project = system.project.getProject([projectname])'?

No, just:

system.project.update('MyProject')

Ah, i see, thanks! will try.

Still 500ing. Where would I find the print logs?

In the wrapper.log files wherever the Ignition Gateway is installed.

Yep, found it. it's saying that project has no update attribute even though script console project.update works -- should I just restart my designer?

You may have screwed up your environment if you ran this snippet at any point and redefined system.project:

system.project = system.project.getProject([projectname])

Restart the Gateway if that's the case... or maybe a project save or module restart would be enough, not sure.

Restoring my gateway from a recent backup, then reinstalling the module.

Restarting should have been more than enough. You just overwrote the system.project package if that snippet actually ran. It's not something that would survive a restart.

system.project in webdev has a getProject member function but not an update member function according to the webdev IDE. but system.project.update works in the script console.

Do i need to do something special to bring update into the context of the webdev module, since it's in the designer context?

WebDev handlers run in the Gateway, not the Designer. You're just writing the code in the Designer.

Sure -- so will I be able to call system.project.update(projectname) there? Python doesn't seem to be recognizing that as a valid method.

Ok I just took a closer look at this project because I've never actually seen or used it before.

It seems system.project.update() is only available in the Designer. It updates the Designer with the current version of the project on the Gateway.

I don't think this function does whatever is you were hoping it did, because it doesn't make sense to call from any other scope.

Sure -- what i'm trying to do is trigger a call to the designer to update whenever the gateway restarts. I figured one way to do that would be via webdev, is there an alternative scripting mechanism I should use?

You would need to do something like system.util.sendMessage() from your WebDev hook and send a message to every Designer instance where you tell it to run system.project.update().

Ah, I see, thank you.

Where would I put that message handler? the script events seem focused on 'gateway receiving a script message' not 'designer receiving a script message'