# pretend this isn't just a loop. pretend these are actually web requests, and scope isn't shared, but thread_data is available.
# perhaps I can initialize the encrypter, and store it in thread_data
# perhaps an initialized encrypter can be assigned to the Fields class when it's imported by the thread.
for request in currentThread.newRequests():
storage = Fields(**request)
# idea is that there is a _set_encrypted function that will automatically encrypt values being assigned to it
storage.encrypted = request.specialValue
class Fields(sqlobject):
def _set_encrypted(self, value):
"""Store the encrypted value, not the plain value.
"""
# constantly initialize the encrypter?
# would like to avoid that.
class encrypter():
def __init__(self):
self.loadKey()
# ...
def encrypt(self, msg):
return self.encryptMsgUsingKey(msg)