Jump to content

Reply on Note makes unable to create next Note


Jakub Trllo

Recommended Posts

Hi, I've probably found a `bug` in ftrack_api,

When I'm creating multiple notes on entity it works correctly but when a reply on one of those notes is added then on next following note commit session crashes.

Example code:

task = session.query('Task').first()
user = session.query('User').first()

# This will work as expected
task.create_note('Note 1', user)
session.commit()

task.create_note('Note 2', user)
session.commit()

# This will crash
note3 = task.create_note('Note 3', user)
session.commit()

note3.create_reply('Reply 1', user)
session.commit()

task.create_note('Note 4', user)
session.commit() # On this line

Reason is missing recipient. I've tried to create it manually but I didn't found out what `resource_id` represents.

I need it working ASAP, please help.

Thanks!

Link to comment
Share on other sites

Hi @Jakub Trllo, look like you hit a genuine bug there ! 
Thanks for reporting, we will soon start looking into it.

For now though you can use this workaround (see the session.reset() before the last commit)

task = session.query('Task').first()
user = session.query('User').first()

# This will work as expected
task.create_note('Note 1', user)
session.commit()

task.create_note('Note 2', user)
session.commit()

note3 = task.create_note('Note 3', user)
session.commit()

note3.create_reply('Reply 1', user)
session.commit()

task.create_note('Note 4', user)
# here is the fix
session.reset() # reset the session
session.commit() # On this line

Hope it helps!
L.

Link to comment
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
×
×
  • Create New...