Fixed a few consumer bugs and added an exporter

Rename exporter to export and fixt some debugging

Account for files not matching the sender/title pattern

Added a safety note

Wrong regex on the name parser

Renamed the command to something slightly less ambiguous
This commit is contained in:
Daniel Quinn
2016-01-14 19:47:57 +00:00
parent 2e48036f92
commit 17615d43cb
9 changed files with 141 additions and 24 deletions

24
src/paperless/db.py Normal file
View File

@@ -0,0 +1,24 @@
import gnupg
from django.conf import settings
class GnuPG(object):
"""
A handy singleton to use when handling encrypted files.
"""
gpg = gnupg.GPG(gnupghome=settings.GNUPG_HOME)
@classmethod
def decrypted(cls, path):
return cls.gpg.decrypt_file(path, passphrase=settings.PASSPHRASE).data
@classmethod
def encrypted(cls, path):
return cls.gpg.encrypt_file(
path,
recipients=None,
passphrase=settings.PASSPHRASE,
symmetric=True
).data

View File

@@ -148,4 +148,3 @@ CONSUMPTION_DIR = os.environ.get("PAPERLESS_CONSUME")
# `None` and you'll be prompted for the passphrase at runtime. The default
# looks for an environment variable.
PASSPHRASE = os.environ.get("PAPERLESS_PASSPHRASE")