diff options
author | Michael Gmelin <grembo@FreeBSD.org> | 2020-01-03 00:19:58 +0000 |
---|---|---|
committer | Michael Gmelin <grembo@FreeBSD.org> | 2020-01-03 00:19:58 +0000 |
commit | 485c710fc3b23d2c460cfe81d84873b5d5f4810d (patch) | |
tree | fdae1385224a3179f4fea784b27cdf4a113906fd /deskutils/py-paperless/files/patch-src-documents-models.py | |
parent | games/eboard: fix build on GCC architectures (diff) |
Port back filename transformation feature from pull request
https://github.com/the-paperless-project/paperless/pull/542
Adapt man page to new default python version. Remove stale comment.
Diffstat (limited to 'deskutils/py-paperless/files/patch-src-documents-models.py')
-rw-r--r-- | deskutils/py-paperless/files/patch-src-documents-models.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/deskutils/py-paperless/files/patch-src-documents-models.py b/deskutils/py-paperless/files/patch-src-documents-models.py new file mode 100644 index 000000000000..c8ad8e8d453d --- /dev/null +++ b/deskutils/py-paperless/files/patch-src-documents-models.py @@ -0,0 +1,18 @@ +--- src/documents/models.py.orig 2019-01-27 13:48:05 UTC ++++ src/documents/models.py +@@ -483,8 +483,14 @@ class FileInfo: + "<title>.<suffix>" + """ + ++ filename = os.path.basename(path) ++ for (pattern, repl) in settings.FILENAME_PARSE_TRANSFORMS: ++ (filename, count) = pattern.subn(repl, filename) ++ if count: ++ break ++ + for regex in cls.REGEXES.values(): +- m = regex.match(os.path.basename(path)) ++ m = regex.match(filename) + if m: + properties = m.groupdict() + cls._mangle_property(properties, "created") |