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

Method load_record_data

keepercommander/vault.py:257–271  ·  view source on GitHub ↗
(self, data, extra=None)

Source from the content-addressed store, hash-verified

255 return 'general'
256
257 def load_record_data(self, data, extra=None):
258 self.title = sanitize_str_field_value(data.get('title')).strip()
259 self.login = sanitize_str_field_value(data.get('secret1')).strip()
260 self.password = sanitize_str_field_value(data.get('secret2'))
261 self.link = sanitize_str_field_value(data.get('link'))
262 self.notes = sanitize_str_field_value(data.get('notes'))
263 custom = data.get('custom')
264 if isinstance(custom, list):
265 self.custom.extend((CustomField(x) for x in custom if isinstance(x, dict) and 'name' in x))
266 if isinstance(extra, dict):
267 if 'files' in extra:
268 self.attachments = [AttachmentFile(x) for x in extra['files']]
269
270 if 'fields' in extra and isinstance(extra['fields'], list):
271 self.totp = next((x.get('data', '') for x in extra['fields'] if x.get('field_type') == 'totp'), '')
272
273 def enumerate_fields(self):
274 # type: () -> Iterable[Tuple[str, Union[None, str, List[str]]]]

Callers

nothing calls this directly

Calls 4

sanitize_str_field_valueFunction · 0.85
AttachmentFileClass · 0.85
getMethod · 0.80
CustomFieldClass · 0.70

Tested by

no test coverage detected