reverting entities, and event loops
2 2

7 posts in this topic

Heya everyone,

I'm attempting to prevent users from renaming entities in an action subscribed to the ftrack.update event.

In doing so, I set off another ftrack.update event, which calls the action, which sets off another ftrack.update event.

Any clues would be most appreciated.

G

 

Share this post


Link to post
Share on other sites

@Remus Avram: Thank you Remus, we ended up following your breadcrumb and creating a dedicated API user to filter through the events.  Works like a charm, but quite disappointing that it requires a license.

Thanks again for the offer to help.  It's much appreciated.

Cheers,

G

Share this post


Link to post
Share on other sites

Hi Everyone,

here is a workaround for this issue.

I can't guarantee that it works in all situations or that we will not change something in the future causing it to fail.

 

When creating the API session you will use to make the changes you can set the client token header which will be included in update events triggered from that update.

session = ftrack_api.Session()
session._request.headers.update(
    {'ftrack-clienttoken': 'API-EVENT-UPDATER-TOKEN'}
)

Then in your listener you can get clientToken from the data in the event to check if you were the one triggering this event.

Good luck!

Share this post


Link to post
Share on other sites
On 11/2/2017 at 5:26 PM, Björn Rydahl said:

I can't guarantee that it works in all situations or that we will not change something in the future causing it to fail.

Thanks Bjorn.  Way to sell the appraoch! ;)

G

Share this post


Link to post
Share on other sites

:) I just dont want you to come after me if it does change.

We are however discussing this internally and considering adding it to the API clients so that you dont have to add the headers yourself which would make it a permanent solution.

Cheers

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
2 2