Skip to content

show/hide _fields #28

@cedricduriau

Description

@cedricduriau

Hi

Little introduction, my name is Cedric Duriau and I am a pipeline developer @ Grid (Ghent Belgium).
I am on a r&d project regarding the implementation of a custom wrap over your ShotgunOrm.

Everything so far seemed to work except the registering of default query fields. I have some custom entities inheriting SgEntity and the CRUD functions work fine, but the properties/_fields are always the full list of fields present on the entity in Shotgun. I read in the docs that this normally should not be happening.

After digging into the code, I noticed the SgEntityClassFactory.py has a createEntity function where the field building happens. The sgData variable is populated by the fields mentioned in the registerDefaultQueryFields function, which is what you would expect to be available as properties.

146. sgData = ShotgunORM.beforeEntityCreate(self.connection(), sgEntityType, sgData)

Next line (153), the entityClass is created where the _fields attr is still an empty dict.
Then the next line (155) is the one querying the schema for all the fields and return types.
Line 156 seems to set the variable mentioned in the default query fields function.

153. result = entityClass()
155. result.buildFields()
156. result._fromFieldData(sgData)

This all results in returning the created entity with all schema fields read on the entity as properties.
Am I doing something wrong or shouldn't this be happening on the api side?

Cheers
Cedric

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions