New API : how to assign user to a task
4 4

8 posts in this topic

Hi !

I'm trying to assign user for a task with new API.

I've found a tutorial from legacy API :

 

currentUser = ftrack.User(getpass.getuser())

task.assignUser(currentUser)

 

Can someone englighten me how to achieve this with new API ?

Thanks in advance

Share this post


Link to post
Share on other sites

Hi Remus,

Thank you for the reply.

I tried with your suggestion.  And I've got this error:

session.assign_user(user= user, context= task)
AttributeError: 'Session' object has no attribute 'assign_user'

I looked into "\site-packages\ftrack_api\session.py" , couldn't find "assign_user" method.

I made sure session is working properly by querying some tasks and projects.  So it is genuine session object.

Any idea ?

 

Share this post


Link to post
Share on other sites
2 hours ago, strbpy said:

I tried with your suggestion.  And I've got this error:


session.assign_user(user= user, context= task)
AttributeError: 'Session' object has no attribute 'assign_user'

I looked into "\site-packages\ftrack_api\session.py" , couldn't find "assign_user" method.

 

sorry for the confusion. 'assign_user' method is an internal method. 

The right way to assign a user to a task is in the example with Mattias pointed.

Cheers!

Share this post


Link to post
Share on other sites
On 9/1/2016 at 0:22 PM, Remus Avram said:

sorry for the confusion. 'assign_user' method is an internal method. 

 

There is a way to mixin functionality into an entity class, to add custom helper methods. E.g. task.assign_user(user). I can recommend looking at http://ftrack-python-api.rtd.ftrack.com/en/latest/working_with_entities.html#customising-entity-types

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
4 4