0

Link user to project

Hi guys. I'm trying to link some artists to project, so i do this:

# Get all linked users

sg_projectUsers = sg.find_one('Project', filters = [['id', 'is', 152]], fields=['users'])['users']

pprint(sg_projectUsers)

#Result:

[{'id': 161, 'name': 'Alexey #####', 'type': 'User'},
{'id': 174, 'name': 'Dmitry ####', 'type': 'User'},
{'id': 138, 'name': 'Maxim #####', 'type': 'User'}]

The question is - what is 'User" type?? This type is inappropriate for updating project:

data = dict(users = sg_projectUsers)

sg.update('Project', 152, data)

# This causing errors

shotgun_api3.shotgun.Fault: API update() invalid/missing entity hash string 'type':
{"name"=>"Alexey #####", "type"=>"User", "id"=>161}

So i have to change type to 'HumanUser' before calling update:

for u in sg_projectUsers:

    u['type'] = 'HumanUser'

After that, all works fine. So tell me please, is it ok doing this? Or there is beter solution? Thx!

3件のコメント

  • 0
    Avatar
    Mandy Hampton

    Hi Alexey!

    Sorry it's taken so long to get back to you.  Just letting you know, it's totally fine to change the type of the user entity before you re-ingest the data, but you're right those records should be returning correctly in the initial find command.  I've added this as a ticket, but in the meantime, you're fine to continue with the solution you've found.

     

    Thanks for the heads up,

    Mandy

  • 0
    Avatar
    Alexey Sadrutdinov

    Thanks Mandy.

  • 0
    Avatar
    KP

    Alexey,

    To clarify, this was a bug in v3.2.0 and was fixed in v3.2.1 over a year ago (Feb, 2012). You can see this in the release notes here: https://support.shotgunsoftware.com/entries/20905776-3-2-Release-Notes-Production-

    It would be great to get in touch about scheduling an upgrade so you guys can pick up this (and lots of other) bug fixes as well as new features. 

    cheers,
    kp 

ログインしてコメントを残してください。