3100 Commits

Author SHA1 Message Date
Erik Arvstedt
8b37af994a Consider mtime of ignored files, garbage-collect ignore list
1. Store the mtime of ignored files so that we can reconsider them if
they have changed.

2. Regularly reset the ignore list to files that still exist in the
consumption dir. Previously, the list could grow indefinitely.
2018-05-11 14:05:30 +02:00
Erik Arvstedt
cc22204e5a Simplify ignoring docs 2018-05-11 14:05:29 +02:00
Erik Arvstedt
f56ec70aad Ensure docs have been unmodified for some time before consuming
Previously, the second mtime check for new files usually happened right
after the first one, which could have caused consumption of docs that
were still being modified.

We're now waiting for at least FILES_MIN_UNMODIFIED_DURATION (0.5s).

This also cleans up the logic by eliminating the consumer.stats attribute
and the weird double call to consumer.run().

Additionally, this a fixes memory leak in consumer.stats where paths could be
added but never removed if the corresponding files disappeared from
the consumer dir before being considered ready.
2018-05-11 14:05:29 +02:00
Erik Arvstedt
0db6ed225b Refactor: extract fn try_consume_file
The main purpose of this change is to make the following commits more
readable.
2018-05-11 14:05:28 +02:00
Erik Arvstedt
312a6a91b5 Use os.scandir instead of os.listdir
It's simpler and better suited for use cases introduced in later commits.
2018-05-11 14:05:25 +02:00
Erik Arvstedt
2c64e70754 Consume documents in order of increasing mtime
This increases overall usability, especially for multi-page scans.
Previously, the consumption order was undefined (see os.listdir())
2018-05-11 14:04:37 +02:00
Erik Arvstedt
9320230100 Refactor: extract fn 'make_dirs' 2018-05-11 14:04:36 +02:00
Erik Arvstedt
8ebe52a7db Fix list out of bounds error in mail message parsing
Check list length before accessing the first two elements of
'dispositions'.
The list may have only a single element ('inline') or may be empty in
mailformed emails.
2018-05-11 14:04:36 +02:00
Erik Arvstedt
260ce7d75c Set default empty PAPERLESS_EMAIL_SECRET
Previously, if the user didn't set PAPERLESS_EMAIL_SECRET, Paperless
failed with an error in check_body() because self.SECRET was None.
2018-05-11 14:04:31 +02:00
Erik Arvstedt
d5e56095ac Mail fetching: Only catch internal errors
Previously, all errors raised during mail fetching were silently caught
and printed without backtrace.

To increase robustness and ease debugging, we now fail with a backtrace
on unexpected errors.
2018-05-11 14:01:09 +02:00
Erik Arvstedt
8033f97ec3 Increase link area in documents listing
Increase the link area to include the whole visual header.

Fixes #335
2018-05-11 13:50:09 +02:00
Daniel Quinn
bce2d3dd22 Account for KeyError problem in #345 2018-04-28 12:20:43 +01:00
Daniel Quinn
f3f86242de Account for KeyError problem in #345 2018-04-28 12:19:53 +01:00
Daniel Quinn
1522af2ea5 Clean up test formatting a bit 2018-04-22 16:28:21 +01:00
Daniel Quinn
b7d321286f Remove old Python style 2018-04-22 16:28:03 +01:00
Daniel Quinn
fe5d55d2d1 Don't explode on invalid dates 2018-04-22 16:27:43 +01:00
CkuT
0c28a5329c Fix LogEntry user when PAPERLESS_DISABLE_LOGIN is set to true 2018-04-17 21:03:18 +02:00
Daniel Quinn
56e3bcefb2 Revert root redirection 2018-04-16 09:53:31 +01:00
Daniel Quinn
ce19c62a1b Put this file where it's supposed to be 2018-04-15 13:41:08 +01:00
Daniel Quinn
85fa861ce7 Remove the hard-coding of the thumbnail URL 2018-04-13 20:18:16 +01:00
Daniel Quinn
199ff5866a Allow STATIC_URL and MEDIA_URL to be configurable via env 2018-04-13 20:18:00 +01:00
Daniel Quinn
e12636f7d2 Use a named URL for the LOGIN_URL value 2018-04-13 20:17:31 +01:00
Daniel Quinn
8f229fa98b Use a URL name for the redirect instead of a hard-coding 2018-04-13 19:45:14 +01:00
Daniel Quinn
e6006a046c Fix links and grammar 2018-04-13 19:43:56 +01:00
Daniel Quinn
f8c83d968d Add THANKS.md 2018-04-10 19:37:42 +01:00
Erik Arvstedt
363b8ff9aa Fix runtime warning when adding log entries
LogEntry.action_time expects a Django timezone object instead of a builtin datetime.

This fixes a runtime warning of the following kind:
RuntimeWarning: DateTimeField LogEntry.action_time received a naive datetime (2018-03-28 20:53:01.714173) while time zone support is active.
2018-03-30 00:15:52 +02:00
Daniel Quinn
fd85f49397 Merge pull request #326 from CkuT/new_document_list
New imported documents list
2018-03-19 12:50:18 +00:00
Daniel Quinn
748128c8c3 Remove last remnants of PAPERLESS_SHARED_SECRET 2018-03-18 14:08:41 +00:00
Daniel Quinn
245027767d Remove superfluous import 2018-03-18 14:08:29 +00:00
CkuT
9bf3454cbf Add test case 2018-03-13 19:27:59 +01:00
CkuT
53214b7993 Use datetime.now() instead of document.created for LogEntry action_time 2018-03-13 19:09:48 +01:00
CkuT
feab3e5dfc Add LogEntry after document consumption
See #319
2018-03-11 17:09:43 +01:00
Daniel Quinn
00cc5c49d1 Merge pull request #320 from ovv/detected-document-date-log-iso
Log detected document date with isoformat
2018-03-05 12:37:28 +01:00
Martin Arendtsen
79d2152ce1 Added support for paperless.conf in /usr/local/etc 2018-03-04 21:37:04 +01:00
Ovv
32c440cbd9 Log detected document date with isoformat 2018-03-04 13:10:49 +01:00
Daniel Quinn
19209ba5af Run a --oneshot loop twice
This was necessary since the first loop only ever collects file
statistics so that the second run can be sure about "readiness".
2018-03-03 18:43:20 +00:00
Daniel Quinn
13452ba33b Clean up docstring to be properly rst 2018-03-03 18:43:20 +00:00
Ovv
340855cd87 Help & documentation 2018-03-03 18:43:20 +00:00
Ovv
cc5dd576e0 remove consume env var from pytest.ini 2018-03-03 18:43:20 +00:00
Ovv
2262a6ec28 use tmp dir 2018-03-03 18:43:20 +00:00
Ovv
b10c2c770c style & test 2018-03-03 18:43:20 +00:00
Ovv
d89dbbe537 Configuration cli argument for document_consumer 2018-03-03 18:43:20 +00:00
Ovv
3c07199b4f Add documentation testing 2018-02-27 13:30:02 +01:00
Ovv
68ae634c1f Add back tox 2018-02-27 12:27:21 +01:00
Daniel Quinn
149aaf0bae Have pytest generate the coverage files 2018-02-25 16:42:15 +00:00
Daniel Quinn
f2796ab408 Consolidate CI tools into setup.cfg and drop tox 2018-02-25 15:51:59 +00:00
Daniel Quinn
d4e4861078 Merge pull request #309 from danielquinn/mysql-hack
Add another db_index hack for MySQL.

Fixes #308.
2018-02-25 12:53:38 +01:00
Daniel Quinn
e1894aeeeb Update for 1.3.0 2018-02-25 11:47:39 +00:00
Daniel Quinn
3570896620 Add another db_index hack for MySQL 2018-02-20 11:17:11 +00:00
Wolf-Bastian Pöttner
328330eb08 Increase testcoverage by testing two more date detection cases 2018-02-19 21:36:48 +01:00