(self, value)
| 97 | raise ValueError("Decryption failed - possibly wrong SECRET_KEY or corrupted data") from e |
| 98 | |
| 99 | def to_python(self, value): |
| 100 | if isinstance(value, (dict, list)): |
| 101 | return value |
| 102 | if isinstance(value, str): |
| 103 | try: |
| 104 | return json.loads(value) |
| 105 | except (json.JSONDecodeError, ValueError): |
| 106 | # Value is likely already-encrypted ciphertext from the DB, |
| 107 | # which will be handled by from_db_value. Return as-is. |
| 108 | return value |
| 109 | return value |
nothing calls this directly
no outgoing calls
no test coverage detected