-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
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).