Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chained mutator calls from metadata manager do not preserve state #709

@d-w-moore

Description

@d-w-moore

obj.metadata(flag1=value)(flag2=value) has a different outcome from obj.metadata(flag1=value,flag2=value)
That is, later calls in the chain do not preserve state from the previous ones.

Here's an example:

Running the following example will show how state established in the first call of the chain (setting the adminFlag for metadata API calls) is erased in the second call.

import irods.helpers as h
s=h.make_session();
d = s.data_objects.get('/some/data/object')
metacollection = d.metadata

# ----- Part 1. Success in combined parameters case

m_same_call = metacollection( admin=True, timestamps = True ) # m_same_call.add(...) will apply admin flag to API call
print(f'{m_same_call._manager._MetadataManager__kw = }')

# If attempted here, m_same_call.add(...) can't make an admin enabled call as it lacks the admin flag

# ----- Part 2. Failure in chained call case

m_chained_calls = metacollection( admin=True )( timestamps = True )
print(f'{m_chained_calls._manager._MetadataManager__kw = }')

# If attempted here, with: m_chained_calls.add(...) 
# we cannot make an admin enabled call using m_chained_calls
# (because the timestamps = True invocation has erased previous state including the admin flag).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions