Return the referenced record cache
(params, record_uid)
| 177 | |
| 178 | |
| 179 | def get_record(params, record_uid): |
| 180 | """Return the referenced record cache""" |
| 181 | record_uid = record_uid.strip() |
| 182 | |
| 183 | if not record_uid: |
| 184 | logging.warning('No record UID provided') |
| 185 | return |
| 186 | |
| 187 | if not params.record_cache: |
| 188 | logging.warning('No record cache. Sync down first.') |
| 189 | return |
| 190 | |
| 191 | if record_uid not in params.record_cache: |
| 192 | logging.warning('Record UID %s not found in cache.' % record_uid) |
| 193 | return |
| 194 | |
| 195 | cached_rec = params.record_cache[record_uid] |
| 196 | version = cached_rec.get('version', 2) |
| 197 | |
| 198 | try: |
| 199 | rec = Record(record_uid) |
| 200 | data = json.loads(cached_rec['data_unencrypted']) |
| 201 | extra = json.loads(cached_rec['extra_unencrypted']) if cached_rec.get('extra_unencrypted') else None |
| 202 | rec.load(data, version=version, revision=cached_rec['revision'], extra=extra) |
| 203 | if not resolve_record_view_path(params, record_uid): |
| 204 | rec.mask_password() |
| 205 | return rec |
| 206 | except: |
| 207 | logging.error('**** Error decrypting record %s', record_uid) |
| 208 | |
| 209 | |
| 210 | def is_shared_folder(params,shared_folder_uid): |
no test coverage detected