MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / update_custom_text_fields

Function update_custom_text_fields

keepercommander/plugins/commands.py:113–126  ·  view source on GitHub ↗
(record, new_field_dict)

Source from the content-addressed store, hash-verified

111
112
113def update_custom_text_fields(record, new_field_dict):
114 fld_attr = plugin_manager.get_custom_field_attr(record)
115 for f in record.custom:
116 field_name = getattr(f, fld_attr)
117 if field_name in new_field_dict:
118 if isinstance(record, TypedRecord):
119 f.value[0] = new_field_dict.pop(field_name)
120 elif isinstance(record, PasswordRecord):
121 f.value = new_field_dict.pop(field_name)
122 for k, v in new_field_dict.items():
123 if isinstance(record, TypedRecord):
124 record.custom.append(TypedField({'type': 'text', 'label': k, 'value': [v]}))
125 elif isinstance(record, PasswordRecord):
126 record.custom.append(CustomField({'type': 'text', 'name': k, 'value': v}))
127
128
129def update_password(params, record, new_password, plugin):

Callers 1

update_passwordMethod · 0.85

Calls 2

TypedFieldClass · 0.85
CustomFieldClass · 0.50

Tested by

no test coverage detected