Move the encrypt/decrypt decision out of db and into the view

This commit is contained in:
Daniel Quinn
2018-05-28 12:58:28 +01:00
parent da6dc2ad5b
commit cdc07cf153
2 changed files with 7 additions and 6 deletions
-4
View File
@@ -12,15 +12,11 @@ class GnuPG(object):
@classmethod
def decrypted(cls, file_handle):
if(not settings.ENABLE_ENCRYPTION):
return file_handle.read()
return cls.gpg.decrypt_file(
file_handle, passphrase=settings.PASSPHRASE).data
@classmethod
def encrypted(cls, file_handle):
if(not settings.ENABLE_ENCRYPTION):
return file_handle.read()
return cls.gpg.encrypt_file(
file_handle,
recipients=None,