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

Function update_custom_text_fields

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

Source from the content-addressed store, hash-verified

174
175
176def update_custom_text_fields(record, new_field_dict):
177 fld_attr = plugin_manager.get_custom_field_attr(record)
178 for f in record.custom:
179 field_name = getattr(f, fld_attr)
180 if field_name in new_field_dict:
181 if isinstance(record, TypedRecord):
182 f.value[0] = new_field_dict.pop(field_name)
183 elif isinstance(record, PasswordRecord):
184 f.value = new_field_dict.pop(field_name)
185 for k, v in new_field_dict.items():
186 if isinstance(record, TypedRecord):
187 record.custom.append(TypedField({'type': 'text', 'label': k, 'value': [v]}))
188 elif isinstance(record, PasswordRecord):
189 record.custom.append(CustomField({'type': 'text', 'name': k, 'value': v}))
190
191
192def 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