Originally we used SHARED secret both for email and for the API. That
was a bad idea, and now that we're only using this value for one case,
I've renamed it to reflect its actual use.
I've broken out the OCR-specific code from the consumers and dumped it
all into its own app, `paperless_tesseract`. This new app should serve
as a sample of how to create one's own consumer for different file
types.
Documentation for how to do this isn't ready yet, but for the impatient:
* Create a new app
* containing a `parsers.py` for your parser modelled after
`paperless_tesseract.parsers.RasterisedDocumentParser`
* containing a `signals.py` with a handler moddelled after
`paperless_tesseract.signals.ConsumerDeclaration`
* connect the signal handler to
`documents.signals.document_consumer_declaration` in
`your_app.apps`
* Install the app into Paperless by declaring
`PAPERLESS_INSTALLED_APPS=your_app`. Additional apps should be
separated with commas.
* Restart the consumer
This change includes a filthy hack around how Django handles
change_list_results.html -- I'm not thrilled with it, but it's as
elegant as I could come up with. I'm happy to field alternative ideas.
More details can be found in `documents/templatetags/hacks.py`
Specifically, this merge includes a significant facelift to the
documents listing page, moving away from the tabular layout and toward a
tileset look. I tried fiddling with the colours, but I just don't have
any skills in that area, so we're all stuck with Django'd default
colours until someone with an eye for colour can submit a better CSS.
Introduce some creative code around setting of ALLOWED_HOSTS that defaults to ['*']. Also added PAPERLESS_ALLOWED_HOSTS to paperless.conf.example with an explanation as to what it's for
There appears to be quite the mess out there with regard to how DRF
handles filtering. DRF has its own built-in stuff, but recommends
django_filter for the advanced stuff, which has its own overriding
module that explodes with this message when used as per the
documentation:
AttributeError: 'NoneType' object has no attribute 'DjangoFilterBackend'
Then there's djangorestframework-filter, another package that claims to
do the same thing, that does everything just differently enough that
nothing worked while I had it enabled.
I ended up using django_filter, but doing so importing each element
explicitly, rather than just using the recommended (and broken, at least
in this project) method of:
import django_filter.restframework as fitlers
Anyway, this should bring the dependencies up to date, and strips out a
lot of redundant code.
* PEP8 conformity
* rename run_post_consume_external_script to run_post_consume_script
* rename run_pre_consume_external_script to run_pre_consume_script
* change order of declaration and use from post...pre to pre...post