Commit Graph

267 Commits

Author SHA1 Message Date
Erik Arvstedt 61cd050e24 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 f018e8e54f 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 a56a3eb86d 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 2fe7df8ca0 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 873c98dddb Refactor: extract fn 'make_dirs' 2018-05-11 14:04:36 +02:00
Erik Arvstedt ea287e0db2 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 4babfa1a5b 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 aa2fc84d7f 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
Daniel Quinn 20a4a66a57 Clean up test formatting a bit 2018-04-22 16:28:21 +01:00
Daniel Quinn 4ed1fff518 Remove old Python style 2018-04-22 16:28:03 +01:00
Daniel Quinn 7223ea3c3f Don't explode on invalid dates 2018-04-22 16:27:43 +01:00
CkuT 3aafabba26 Fix LogEntry user when PAPERLESS_DISABLE_LOGIN is set to true 2018-04-17 21:03:18 +02:00
Daniel Quinn 27c72a7bc6 Remove the hard-coding of the thumbnail URL 2018-04-13 20:18:16 +01:00
Erik Arvstedt fcdcf62c2c 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 da1d3820ec Merge pull request #326 from CkuT/new_document_list
New imported documents list
2018-03-19 12:50:18 +00:00
Daniel Quinn f778d3a6e3 Remove last remnants of PAPERLESS_SHARED_SECRET 2018-03-18 14:08:41 +00:00
Daniel Quinn 96a94c4ee9 Remove superfluous import 2018-03-18 14:08:29 +00:00
CkuT 1d162dc769 Add test case 2018-03-13 19:27:59 +01:00
CkuT a1f257369d Use datetime.now() instead of document.created for LogEntry action_time 2018-03-13 19:09:48 +01:00
CkuT 45e18d7094 Add LogEntry after document consumption
See #319
2018-03-11 17:09:43 +01:00
Daniel Quinn d0252e8e44 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 73e62600c2 Clean up docstring to be properly rst 2018-03-03 18:43:20 +00:00
Ovv f56dafe7d9 Help & documentation 2018-03-03 18:43:20 +00:00
Ovv f8c6c07bb7 use tmp dir 2018-03-03 18:43:20 +00:00
Ovv 8fefafb844 style & test 2018-03-03 18:43:20 +00:00
Ovv d1a57b5d68 Configuration cli argument for document_consumer 2018-03-03 18:43:20 +00:00
Daniel Quinn 76a13dadb8 Add another db_index hack for MySQL 2018-02-20 11:17:11 +00:00
Daniel Quinn ea6d040809 Monitor return codes of calls to convert and unpaper
...and handle the failures nicely.  Addresses #303.
2018-02-18 16:02:27 +00:00
Daniel Quinn fb1da4834c Style and removal of Python 2.7 stuff 2018-02-18 15:55:55 +00:00
Daniel Quinn 11a9c756b3 Updated for style and to add a --use-first option 2018-02-08 20:03:29 +00:00
Dashie 11accaff7f Fix line length 2018-02-08 19:34:48 +00:00
Dashie 77aee832e4 Add manager command to re-tag documents without correspondent 2018-02-08 19:34:48 +00:00
Daniel Quinn 273916973c Remove superfluous code 2018-02-04 13:27:26 +00:00
Daniel Quinn cebb8b9fa2 Use paperless- instead of paperless for tempdir name
This is purely aesthetic.
2018-02-03 14:49:17 +00:00
Daniel Quinn 46aca10a72 No need to explicitly extend object 2018-02-03 14:49:01 +00:00
Daniel Quinn 6384c698ad Fix DeprecationWarning as-per ishirav's advice 2018-02-03 14:48:14 +00:00
Wolf-Bastian Pöttner b140935843 Add support for a heuristic that extracts the document date from its text 2018-01-28 19:37:10 +01:00
Daniel Quinn 09e1b505e1 Merge pull request #256 from ddddavidmartin/add_financial_year_filter
Add financial year documents filter
2018-01-21 18:23:45 +01:00
pzl 0256e2dfbb small typo in exporter thumbnail filename 2018-01-19 14:28:46 -05:00
Daniel Quinn 6fe37678f2 Change date fields to actual date fields #278 2018-01-06 19:21:49 +00:00
Daniel Quinn 35004f434b Add a smarter work-around for the change-list-results hack 2018-01-06 18:47:01 +00:00
Daniel Quinn 75251ad694 Add a note for future development 2018-01-06 18:30:33 +00:00
Daniel Quinn 870357968a Fix tests to run on boxes with post-consume-scripts set 2018-01-06 17:23:24 +00:00
Daniel Quinn a593798b4b Add encoding declaration 2018-01-06 17:23:07 +00:00
Daniel Quinn 4f070ba162 Use double quotes by default 2018-01-06 17:22:57 +00:00
Daniel Quinn 35bb3dbcc2 Clean up CSS for #272 2018-01-06 15:57:25 +00:00
ishirav d1c8241947 break long lines (pep8) 2017-12-23 07:39:40 +02:00
ishirav 4c38b28469 break long lines (pep8) 2017-12-23 06:59:48 +02:00
ishirav 83746a9aeb Add tests and improve whitespace handling 2017-12-23 06:37:00 +02:00
ishirav 6a36a4ec97 Support search terms that contain multiple words in ANY/ALL matching modes, by surrounding the terms with double quotes. 2017-12-23 06:05:48 +02:00