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