Skip to content

Commit 7ea3af4

Browse files
committed
[_833] fix sticky admin keyword
1 parent 6c2459d commit 7ea3af4

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

‎irods/manager/metadata_manager.py‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ class MetadataManager(Manager):
3636
def __init__(self, *_):
3737
self._opts = _MetadataManager_opts_initializer.copy()
3838
super().__init__(*_)
39+
# For the iRODS-api keywords only (currently ADMIN_KW is the sole one used):
40+
self.__kw = {}
3941

4042
@property
4143
def use_timestamps(self):
4244
return self._opts['timestamps']
4345

44-
__kw: Dict[str, Any] = {} # default (empty) keywords
46+
__default_kw: Dict[str, Any] = {} # default (empty) keywords
4547

4648
def _updated_keywords(self, opts):
4749
kw_ = self.__kw.copy()
@@ -52,18 +54,20 @@ def get_api_keywords(self):
5254
return self.__kw.copy()
5355

5456
def __call__(self, **flags):
55-
# Make a new shallow copy of the manager object, but update options from parameter list.
57+
# Make a new shallow copy of the manager object, but duplicate options from parameter list as well as iRODS API
58+
# flags (stored in the instance's private __kw member) to be applied in each call.
5659
new_self = copy.copy(self)
5760
new_self._opts = copy.copy(self._opts)
61+
new_self.__kw = copy.copy(self.__kw)
5862

5963
# Update the flags that do bookkeeping in the returned(new) manager object.
6064
new_self._opts.update((key, val) for key, val in flags.items() if val is not None)
6165

62-
# Update the ADMIN_KW flag in the returned(new) object.
66+
# For the new object, make ADMIN_KW flag or absence thereof reflect the admin option in _opts.
6367
if new_self._opts.get('admin'):
64-
self.__kw[kw.ADMIN_KW] = ""
68+
new_self.__kw[kw.ADMIN_KW] = ""
6569
else:
66-
self.__kw.pop(kw.ADMIN_KW, None)
70+
new_self.__kw.pop(kw.ADMIN_KW, None)
6771

6872
return new_self
6973

0 commit comments

Comments
 (0)