Skip to content

Fix File Browser's files.properties method #341

@qfalconer

Description

@qfalconer

The File Browser's files.properties method fails because it's trying to unpack a PortalResource object in only two pieces, specifically here:

    def properties(self, path):
        """
        Get object properties.

        :param str path: Path.
        :returns: Object properties.
        :rtype: cterasdk.cio.core.types.PortalResource
        :raises cterasdk.exceptions.io.core.GetMetadataError: Raised on error retrieving object metadata.
        """
        _, metadata = GetProperties(io.listdir, self._core, path, False).execute()    <--- MORE THAN TWO ATTRIBUTES
        return metadata

However this makes no sense as the doc says properties should return the whole PortalResource object. So the fix is straight forward, just return the whole object:

    def properties(self, path):
        """
        Get object properties.

        :param str path: Path.
        :returns: Object properties.
        :rtype: cterasdk.cio.core.types.PortalResource
        :raises cterasdk.exceptions.io.core.GetMetadataError: Raised on error retrieving object metadata.
        """
        return GetProperties(io.listdir, self._core, path, False).execute()

If that's not the intended semantic of properties or my back of the fag analysis was too simplistic, I suggest accessing the attribute of interest by name, rather than unpacking the object (which possibility is already odd out of itself).

Regards,
Porca Madonna

P.S. Also you could really get rid of this print.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions