MCPcopy Create free account
hub / github.com/brightbeanxyz/brightbean-studio / to_python

Method to_python

apps/common/encryption.py:99–109  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected