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

This commit is contained in:
Daniel Quinn
2018-02-04 13:14:23 +00:00
parent e3eb95eb47
commit 3db9544c7f
2 changed files with 7 additions and 6 deletions

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,