diff --git a/Pipfile b/Pipfile index 64a6b923c1..f7e477e0d3 100644 --- a/Pipfile +++ b/Pipfile @@ -14,6 +14,7 @@ PyYAML = ">=3.13" rero-ils = {editable = true, path = "."} uwsgi = ">=2.0" invenio-oaiharvester = {ref = "v1.0.0a4", git = "https://github.com/inveniosoftware/invenio-oaiharvester.git"} +invenio-circulation = {ref = "master", git = "https://github.com/inveniosoftware/invenio-circulation.git"} pip = "<=18.0" pipenv = "*" requests = "==2.20.0" @@ -34,7 +35,7 @@ pytest-pep8 = ">=1.0.6" pytest-random-order = ">=0.5.4" pytest-runner = ">=3.0.0,<5" transifex-client = ">=0.12.5" -requests = ">=2.19.1" +requests = ">=2.20.0" rero-ils = {editable = true, path = "."} [requires] diff --git a/Pipfile.lock b/Pipfile.lock index cae835344d..edf4748353 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "67c2a3ca70bcd66ae6d93455ca8e03a7bd9b1193fe3725d6720dd14e7d692a18" + "sha256": "dfd1b56946f9d6aad7f548ac0b6f11795d1ef6d9e7cc0b3cd6c4d9d6ad1fcd22" }, "pipfile-spec": 6, "requires": { @@ -221,6 +221,7 @@ "sha256:7546cc08e3899716e12fe67d12d7cfe9a64647014d1134b014c3c392b63cad42", "sha256:aada5cfdc4a543c47098eb3aca6663848ef5d04b4324935ced441debc11ec98b" ], + "markers": "extra == 'elasticsearch6'", "version": "==6.3.1" }, "elasticsearch-dsl": { @@ -228,6 +229,7 @@ "sha256:5114a38a88e93a4663782eae07a1e8084ba333c49887335c83de8b8043bc72b2", "sha256:d6d974cd2289543a3350690494a43fe9996485b8dc6f1d8758cb56bee01244bd" ], + "markers": "extra == 'elasticsearch6'", "version": "==6.1.0" }, "flask": { @@ -417,6 +419,13 @@ "version": "==0.8.1" }, "invenio": { + "extras": [ + "auth", + "base", + "elasticsearch6", + "metadata", + "postgresql" + ], "hashes": [ "sha256:76a509756b0276818ee8ff5e5f2912feedfb26b108e301f1b5f2a470838214d3", "sha256:9effe1ca6cbfb3251a220b4780940f6a25f3a369900eef0b0eea69fe67fa644c" @@ -429,6 +438,7 @@ "sha256:7f10b46a546f843db91af2a5af4212469c7a54b1aa8acb6f6352e4f2a94fbfdc", "sha256:d0af1539d58a953f4de7fc7afdc19cb4e8cba0dbb4e00fc7b946c3feb0469095" ], + "markers": "extra == 'auth'", "version": "==1.0.2" }, "invenio-accounts": { @@ -436,6 +446,7 @@ "sha256:9602ba3fd4e8eabcae44c5eb970c1432edb5377ac17cbd46a2a705e81232de6d", "sha256:a52405a0f00305a81175105b5806df60671b75b58c837464cb9f74d92962fa0b" ], + "markers": "extra == 'auth'", "version": "==1.0.2" }, "invenio-admin": { @@ -443,6 +454,7 @@ "sha256:9719448b55dd3a3149965e51c16a7b91518e5bf692233d03498d22eb67339389", "sha256:fc71e1963080df5611e5b0837faddb5d0e723aa277b533bcf2716b6bf78a18c1" ], + "markers": "extra == 'base'", "version": "==1.0.0" }, "invenio-app": { @@ -457,6 +469,7 @@ "sha256:1f9961a3a801a133c1d5f61b7eac4042223a455c62bcefcdc7776e47220933ca", "sha256:7c7b243bd6f83240568d2dc29aca11492172e26638beb8d7f7c577d8247bc31d" ], + "markers": "extra == 'base'", "version": "==1.0.0" }, "invenio-base": { @@ -480,6 +493,10 @@ ], "version": "==1.0.0" }, + "invenio-circulation": { + "git": "https://github.com/inveniosoftware/invenio-circulation.git", + "ref": "3e144794bc636d3c2eceb13125975259a5b5c8a1" + }, "invenio-config": { "hashes": [ "sha256:628f771e351598d7f4e150a30aaa8f3a7daf62f969c7256b6bd211544f5bc494", @@ -488,10 +505,15 @@ "version": "==1.0.1" }, "invenio-db": { + "extras": [ + "postgresql", + "versioning" + ], "hashes": [ "sha256:2c012f3515ea0beb0167493775b3f6c54ea5d2fe3c1ae54d6ff1fc99df534fcc", "sha256:cc3b913bd4bd7a8cf00e0e0ea3afbf2917b6ad8016df83806a335f8fd497a01e" ], + "markers": "extra == 'postgresql'", "version": "==1.0.2" }, "invenio-formatter": { @@ -499,6 +521,7 @@ "sha256:23f60a574d221b46650be8a3ade3b8bf160bacc4d52e6e935dcb1a48a6d3df1d", "sha256:847bae16db9347d193b6fc4f97a33e1642a9ad6275307bef6626e79cc053e55b" ], + "markers": "extra == 'base'", "version": "==1.0.1" }, "invenio-i18n": { @@ -512,6 +535,7 @@ "hashes": [ "sha256:f51a7eda14048da000b4a1ee74a137fd33d9b96119daa968af1b2fe6a4421e8c" ], + "markers": "extra == 'metadata'", "version": "==1.0.1" }, "invenio-jsonschemas": { @@ -519,6 +543,7 @@ "sha256:12e2f3ac6013c741abe9225480183131591f008afb4a685fa3fa96203d7ca07a", "sha256:acaa24e0f9d939a7c63ce24f383779f2b2d2f15925c2d35c4bf346066ce7a67c" ], + "markers": "extra == 'metadata'", "version": "==1.0.0" }, "invenio-logging": { @@ -526,6 +551,7 @@ "sha256:3fbb98df403cf6d8a8fc99aa22229567ea2034d81034dd2347b3cd65689275b7", "sha256:43e23b47c46c3f078240e4aae24640c63743ac9a9955b6c2dc0b495ce073e340" ], + "markers": "extra == 'base'", "version": "==1.0.0" }, "invenio-mail": { @@ -533,6 +559,7 @@ "sha256:6a4181d95b9fa83b11354983c709667c321aa94f7f1ba7e77e4e6b599af762de", "sha256:f55e0dd9467087d85a0495354e8a06a8de5501cddf3e7241a067b84d66d5c009" ], + "markers": "extra == 'base'", "version": "==1.0.1" }, "invenio-oaiharvester": { @@ -544,6 +571,7 @@ "sha256:09cf55273f9ecf01e705b236b5a67006e45ae6a45fe75d9157483245b3ce522e", "sha256:cf4de59f0d5a5af8668852fa58d101badabbd608bc2689fbb08673949f7d3ca8" ], + "markers": "extra == 'metadata'", "version": "==1.0.0" }, "invenio-oauth2server": { @@ -551,6 +579,7 @@ "sha256:726108bc50dc1a0a984f710329fae93785d95fab4e3b7dbfe1337bb5537756bf", "sha256:910f6e7a00607ee5f7c664481723fcf908e374a5d877be781dd235783ef8db3c" ], + "markers": "extra == 'auth'", "version": "==1.0.1" }, "invenio-oauthclient": { @@ -558,6 +587,7 @@ "sha256:0af51d728f98046b3cbe6c9e4e9abe650a26c76442be6c880e5ea7a7159586a5", "sha256:a36e6fdbb1f88876f669a1ac43de75af1fea9790749635b27c07f3cf6bd6318a" ], + "markers": "extra == 'auth'", "version": "==1.0.0" }, "invenio-pidstore": { @@ -565,6 +595,7 @@ "sha256:582b28e7e2bdf4df93e5398a0e147b2eb08690ede339249dd3a8c92b713e6f00", "sha256:77f59075dfa34564b913e5d58f37d55b2c78d7b4fa1eeaa5f8c42576848bb06d" ], + "markers": "extra == 'metadata'", "version": "==1.0.0" }, "invenio-records": { @@ -572,6 +603,7 @@ "sha256:e2203d26c1661ad3e681e6c844a4c299f89047508f16eef6166ec896dd66e0a8", "sha256:f4a9ca9bdb27684ee431af007104c24c6bd75502c02f6f0c87c83d7820692d9d" ], + "markers": "extra == 'metadata'", "version": "==1.0.0" }, "invenio-records-rest": { @@ -579,6 +611,7 @@ "sha256:047fc935bdaf6635f753cee8e949e4d196d56d1afec61a730e4c288df8a22373", "sha256:ef2f25c2ef7c95f7c66dc09a0ca407060d546a69ac24f4caad5d40d37c8310cc" ], + "markers": "extra == 'metadata'", "version": "==1.1.2" }, "invenio-records-ui": { @@ -586,6 +619,7 @@ "sha256:5f6c203735eb109f28a507e4b2d01acbf9e89ee0dc0d618f24cc3c072c73f830", "sha256:662f75200893375f0380347a9053e7b70938a2b370244ed69c6163a43e50b57b" ], + "markers": "extra == 'metadata'", "version": "==1.0.1" }, "invenio-rest": { @@ -593,13 +627,18 @@ "sha256:665cdc6d7f47b532e4823dc1a0a62de32e31caf387efc93aff7593a34124ee1d", "sha256:e5a73fcfc15c052840608950c0524447f1e86d24cc58a8fbf12a48a82f7e582a" ], + "markers": "extra == 'base'", "version": "==1.0.0" }, "invenio-search": { + "extras": [ + "elasticsearch6" + ], "hashes": [ "sha256:b41c7db7cb9adba6d9f1b8ce332bec0b6b647b6ce5df4679620c59e74a9c5970", "sha256:f24f0c1fe083e78574908590a463da80c1def9dd1753d8ba6ab8b123cad75131" ], + "markers": "extra == 'elasticsearch6'", "version": "==1.0.2" }, "invenio-search-ui": { @@ -607,6 +646,7 @@ "sha256:080cc39c4ed24e7a459c833d9344fd55ed7bf0c70e7a2a7c10c82647492a4b52", "sha256:6d5e3f5b2ba3c7c75ce7926da5c4c49635066837748dc21a925592a3389af9bb" ], + "markers": "extra == 'metadata'", "version": "==1.0.1" }, "invenio-theme": { @@ -614,6 +654,7 @@ "sha256:53d30381ee623fbd653a4579e9dda96b6b37ab4cda7097059a7ee5b8862e0b4c", "sha256:b6e1b7ebfc2c338f90e6abe081823a6a60bf2e6c9418995e876321e803546dbb" ], + "markers": "extra == 'base'", "version": "==1.0.0" }, "invenio-userprofiles": { @@ -621,6 +662,7 @@ "sha256:607a8722a3a12af001a0435ca1baf1bbe7e5f359c237acf6c442cc8c5feba515", "sha256:6ab44b7a7682b2ba883f58256bec3c789491c7e78b8e3526622e978647aa2ae6" ], + "markers": "extra == 'auth'", "version": "==1.0.1" }, "ipaddress": { @@ -778,9 +820,36 @@ }, "markupsafe": { "hashes": [ - "sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665" + "sha256:048ef924c1623740e70204aa7143ec592504045ae4429b59c30054cb31e3c432", + "sha256:130f844e7f5bdd8e9f3f42e7102ef1d49b2e6fdf0d7526df3f87281a532d8c8b", + "sha256:19f637c2ac5ae9da8bfd98cef74d64b7e1bb8a63038a3505cd182c3fac5eb4d9", + "sha256:1b8a7a87ad1b92bd887568ce54b23565f3fd7018c4180136e1cf412b405a47af", + "sha256:1c25694ca680b6919de53a4bb3bdd0602beafc63ff001fea2f2fc16ec3a11834", + "sha256:1f19ef5d3908110e1e891deefb5586aae1b49a7440db952454b4e281b41620cd", + "sha256:1fa6058938190ebe8290e5cae6c351e14e7bb44505c4a7624555ce57fbbeba0d", + "sha256:31cbb1359e8c25f9f48e156e59e2eaad51cd5242c05ed18a8de6dbe85184e4b7", + "sha256:3e835d8841ae7863f64e40e19477f7eb398674da6a47f09871673742531e6f4b", + "sha256:4e97332c9ce444b0c2c38dd22ddc61c743eb208d916e4265a2a3b575bdccb1d3", + "sha256:525396ee324ee2da82919f2ee9c9e73b012f23e7640131dd1b53a90206a0f09c", + "sha256:52b07fbc32032c21ad4ab060fec137b76eb804c4b9a1c7c7dc562549306afad2", + "sha256:52ccb45e77a1085ec5461cde794e1aa037df79f473cbc69b974e73940655c8d7", + "sha256:5c3fbebd7de20ce93103cb3183b47671f2885307df4a17a0ad56a1dd51273d36", + "sha256:5e5851969aea17660e55f6a3be00037a25b96a9b44d2083651812c99d53b14d1", + "sha256:5edfa27b2d3eefa2210fb2f5d539fbed81722b49f083b2c6566455eb7422fd7e", + "sha256:7d263e5770efddf465a9e31b78362d84d015cc894ca2c131901a4445eaa61ee1", + "sha256:83381342bfc22b3c8c06f2dd93a505413888694302de25add756254beee8449c", + "sha256:857eebb2c1dc60e4219ec8e98dfa19553dae33608237e107db9c6078b1167856", + "sha256:98e439297f78fca3a6169fd330fbe88d78b3bb72f967ad9961bcac0d7fdd1550", + "sha256:bf54103892a83c64db58125b3f2a43df6d2cb2d28889f14c78519394feb41492", + "sha256:d9ac82be533394d341b41d78aca7ed0e0f4ba5a2231602e2f05aa87f25c51672", + "sha256:e982fe07ede9fada6ff6705af70514a52beb1b2c3d25d4e873e82114cf3c5401", + "sha256:edce2ea7f3dfc981c4ddc97add8a61381d9642dc3273737e756517cc03e84dd6", + "sha256:efdc45ef1afc238db84cb4963aa689c0408912a0239b0721cb172b4016eb31d6", + "sha256:f137c02498f8b935892d5c0172560d7ab54bc45039de8805075e19079c639a9c", + "sha256:f82e347a72f955b7017a39708a3667f106e6ad4d10b25f237396a7115d8ed5fd", + "sha256:fb7c206e01ad85ce57feeaaa0bf784b97fa3cad0d4a5737bc5295785f5c613a1" ], - "version": "==1.0" + "version": "==1.1.0" }, "marshmallow": { "hashes": [ @@ -913,6 +982,7 @@ "sha256:eadbd32b6bc48b67b0457fccc94c86f7ccc8178ab839f684eb285bb592dc143e", "sha256:ecbc6dfff6db06b8b72ae8a2f25ff20fbdcb83cb543811a08f7cb555042aa729" ], + "markers": "extra == 'postgresql'", "version": "==2.7.5" }, "ptyprocess": { @@ -988,17 +1058,17 @@ }, "regex": { "hashes": [ - "sha256:005c8d08a0ef58ec84f5a1130e771f364785c9676e1f6888b0f8f5dea82c9f8d", - "sha256:17c25f45349ec528266823517b12c938733116539ab9a034bdefc867f055e1eb", - "sha256:35cb9c828d4a1c240a06190944e255a6e0418993c9ff5a7143d83fee052810fe", - "sha256:4a8a645072ff7acc96b1a92c76863e324089cd3fd00bc3e41add4a7016c06761", - "sha256:4feab3a003ac5178bb9a5fe347a93031ebf1441051dacf75424ce0573d66473a", - "sha256:56c26497b5f702d1039230eaadf821ef969fdfa05aa6bd8e20dc33733ebc760e", - "sha256:9be8da909d94e78dfcaacae998efa64422544d0465085c17b896c38053da3c1b", - "sha256:deefc467ce773b219b150fc37c1a809e8314045792d4fe9510b7e0d9be3270a0", - "sha256:fdea52683192be51124ace949755b72ed7207594f4d67905bdbfb8536eb51543" + "sha256:384c78351ceb08b9f04e28552edea9af837d05ad4fda9a187a7bbd82759f29b6", + "sha256:41b70db2608726396de185e7571a70391507ab47a64b564f59861ff13f2c50a5", + "sha256:50f4b57696883fdbb0494cf1ff1cf6e04790d5e1848dff0b2cf28a2b97614351", + "sha256:81515123132f9ab0cc8128d035ba7db7783206e4616bdabd3faba335b9add185", + "sha256:91e965833a9f93b3e6abfef815026ccb8a9abe12c0958c723fc6c0d396384602", + "sha256:9cb058e53c2488b6cba85a7e6ce6d659b3f33ebe00f613dc9fda46de788a1298", + "sha256:b41a81228c3994789d4785d9fef96770f9a6b564a30c10af671bd5a4078da6f4", + "sha256:cf20d6539e00021793df23c2a98d57aff84f9402f81ac5896fffb4f8c8a08897", + "sha256:f937fdbcdb1e455c23709f5cf6df91a0ecfe8c23268f601606173232958daa8d" ], - "version": "==2018.11.3" + "version": "==2018.11.6" }, "requests": { "hashes": [ @@ -1066,9 +1136,13 @@ "hashes": [ "sha256:18376f3ab167209a47849e16d33119e3374ec73f58ac5d3dd8e9a37a84956fb8" ], + "markers": "extra == 'versioning'", "version": "==1.3.4" }, "sqlalchemy-utils": { + "extras": [ + "encrypted" + ], "hashes": [ "sha256:45ab41c90bfb8dd676e83179be3088b3f2d64b613e3b590187163dd941c22d4c" ], @@ -1382,9 +1456,36 @@ }, "markupsafe": { "hashes": [ - "sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665" + "sha256:048ef924c1623740e70204aa7143ec592504045ae4429b59c30054cb31e3c432", + "sha256:130f844e7f5bdd8e9f3f42e7102ef1d49b2e6fdf0d7526df3f87281a532d8c8b", + "sha256:19f637c2ac5ae9da8bfd98cef74d64b7e1bb8a63038a3505cd182c3fac5eb4d9", + "sha256:1b8a7a87ad1b92bd887568ce54b23565f3fd7018c4180136e1cf412b405a47af", + "sha256:1c25694ca680b6919de53a4bb3bdd0602beafc63ff001fea2f2fc16ec3a11834", + "sha256:1f19ef5d3908110e1e891deefb5586aae1b49a7440db952454b4e281b41620cd", + "sha256:1fa6058938190ebe8290e5cae6c351e14e7bb44505c4a7624555ce57fbbeba0d", + "sha256:31cbb1359e8c25f9f48e156e59e2eaad51cd5242c05ed18a8de6dbe85184e4b7", + "sha256:3e835d8841ae7863f64e40e19477f7eb398674da6a47f09871673742531e6f4b", + "sha256:4e97332c9ce444b0c2c38dd22ddc61c743eb208d916e4265a2a3b575bdccb1d3", + "sha256:525396ee324ee2da82919f2ee9c9e73b012f23e7640131dd1b53a90206a0f09c", + "sha256:52b07fbc32032c21ad4ab060fec137b76eb804c4b9a1c7c7dc562549306afad2", + "sha256:52ccb45e77a1085ec5461cde794e1aa037df79f473cbc69b974e73940655c8d7", + "sha256:5c3fbebd7de20ce93103cb3183b47671f2885307df4a17a0ad56a1dd51273d36", + "sha256:5e5851969aea17660e55f6a3be00037a25b96a9b44d2083651812c99d53b14d1", + "sha256:5edfa27b2d3eefa2210fb2f5d539fbed81722b49f083b2c6566455eb7422fd7e", + "sha256:7d263e5770efddf465a9e31b78362d84d015cc894ca2c131901a4445eaa61ee1", + "sha256:83381342bfc22b3c8c06f2dd93a505413888694302de25add756254beee8449c", + "sha256:857eebb2c1dc60e4219ec8e98dfa19553dae33608237e107db9c6078b1167856", + "sha256:98e439297f78fca3a6169fd330fbe88d78b3bb72f967ad9961bcac0d7fdd1550", + "sha256:bf54103892a83c64db58125b3f2a43df6d2cb2d28889f14c78519394feb41492", + "sha256:d9ac82be533394d341b41d78aca7ed0e0f4ba5a2231602e2f05aa87f25c51672", + "sha256:e982fe07ede9fada6ff6705af70514a52beb1b2c3d25d4e873e82114cf3c5401", + "sha256:edce2ea7f3dfc981c4ddc97add8a61381d9642dc3273737e756517cc03e84dd6", + "sha256:efdc45ef1afc238db84cb4963aa689c0408912a0239b0721cb172b4016eb31d6", + "sha256:f137c02498f8b935892d5c0172560d7ab54bc45039de8805075e19079c639a9c", + "sha256:f82e347a72f955b7017a39708a3667f106e6ad4d10b25f237396a7115d8ed5fd", + "sha256:fb7c206e01ad85ce57feeaaa0bf784b97fa3cad0d4a5737bc5295785f5c613a1" ], - "version": "==1.0" + "version": "==1.1.0" }, "mock": { "hashes": [ @@ -1411,10 +1512,10 @@ }, "pbr": { "hashes": [ - "sha256:8fc938b1123902f5610b06756a31b1e6febf0d105ae393695b0c9d4244ed2910", - "sha256:f20ec0abbf132471b68963bb34d9c78e603a5cf9e24473f14358e66551d47475" + "sha256:f59d71442f9ece3dffc17bc36575768e1ee9967756e6b6535f0ee1f0054c3d68", + "sha256:f6d5b23f226a2ba58e14e49aa3b1bfaf814d0199144b95d78458212444de1387" ], - "version": "==5.1.0" + "version": "==5.1.1" }, "pep8": { "hashes": [ diff --git a/requirements-devel.txt b/requirements-devel.txt index 4cbe92bf21..e24e4c46de 100644 --- a/requirements-devel.txt +++ b/requirements-devel.txt @@ -27,6 +27,7 @@ # base bundle -e git+https://github.com/inveniosoftware/invenio-admin.git#egg=invenio-admin -e git+git://github.com/inveniosoftware/invenio-assets.git#egg=invenio-assets +-e git+git://github.com/inveniosoftware/invenio-circulation.git#egg=invenio-circulation -e git+git://github.com/inveniosoftware/invenio-formatter.git#egg=invenio-formatter -e git+git://github.com/inveniosoftware/invenio-logging.git#egg=invenio-logging -e git+https://github.com/inveniosoftware/invenio-mail.git#egg=invenio-mail diff --git a/rero_ils/config.py b/rero_ils/config.py index 91cadf80d2..be7e4139cd 100644 --- a/rero_ils/config.py +++ b/rero_ils/config.py @@ -34,6 +34,11 @@ from datetime import timedelta +from invenio_circulation.transitions.transitions import CreatedToItemOnLoan, \ + CreatedToPending, ItemAtDeskToItemOnLoan, \ + ItemInTransitHouseToItemReturned, ItemOnLoanToItemInTransitHouse, \ + ItemOnLoanToItemOnLoan, ItemOnLoanToItemReturned, PendingToItemAtDesk, \ + PendingToItemInTransitPickup from invenio_records_rest.facets import range_filter, terms_filter from invenio_search import RecordsSearch @@ -69,7 +74,7 @@ def _(x): I18N_LANGUAGES = [ ('fr', _('French')), ('de', _('German')), - ('it', _('Italian')) + ('it', _('Italian')), ] # Base templates @@ -107,8 +112,9 @@ def _(x): #: Brand logo. THEME_LOGO = 'images/logo_rero_ils.png' -SEARCH_UI_JSTEMPLATE_RESULTS = \ +SEARCH_UI_JSTEMPLATE_RESULTS = ( 'templates/rero_ils/brief_view_documents_items.html' +) SEARCH_UI_SEARCH_TEMPLATE = 'rero_ils/search.html' SEARCH_UI_JSTEMPLATE_FACETS = 'templates/rero_ils/facets.html' SEARCH_UI_JSTEMPLATE_RANGE = 'templates/rero_ils/range.html' @@ -137,8 +143,7 @@ def _(x): #: Email address used as sender of account registration emails. SECURITY_EMAIL_SENDER = SUPPORT_EMAIL #: Email subject for account registration emails. -SECURITY_EMAIL_SUBJECT_REGISTER = _( - "Welcome to RERO-ILS!") +SECURITY_EMAIL_SUBJECT_REGISTER = _("Welcome to RERO-ILS!") #: Redis session storage URL. ACCOUNTS_SESSION_REDIS_URL = 'redis://localhost:6379/1' # Disable User Profiles @@ -165,21 +170,21 @@ def _(x): 'ebooks-harvester': { 'task': 'invenio_oaiharvester.tasks.list_records_from_dates', 'schedule': timedelta(minutes=60), - 'kwargs': dict(name='ebooks') + 'kwargs': dict(name='ebooks'), }, 'mef-harvester': { 'task': 'rero_ils.modules.apiharvester.tasks.harvest_records', 'schedule': timedelta(minutes=60), - 'kwargs': dict(name='mef') + 'kwargs': dict(name='mef'), }, - } # Database # ======== #: Database URI including user and password -SQLALCHEMY_DATABASE_URI = \ +SQLALCHEMY_DATABASE_URI = ( 'postgresql+psycopg2://rero-ils:rero-ils@localhost/rero-ils' +) #: Disable Versioning due to Bad Performance DB_VERSIONING = False #: Disable warning @@ -232,7 +237,7 @@ def _(x): 'content_security_policy_report_uri': None, 'content_security_policy_report_only': False, 'session_cookie_secure': True, - 'session_cookie_http_only': True + 'session_cookie_http_only': True, } #: Sets cookie with the secure flag by default SESSION_COOKIE_SECURE = False @@ -266,20 +271,23 @@ def _(x): search_index='documents', search_type=None, record_serializers={ - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_response') + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_response' + ) }, search_serializers={ - 'application/rero+json': ('rero_ils.modules.serializers' - ':json_v1_search'), - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_search'), + 'application/rero+json': ( + 'rero_ils.modules.serializers' ':json_v1_search' + ), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_search' + ), }, list_route='/documents/', item_route='/documents/', default_media_type='application/json', max_result_window=10000, - search_factory_imp='rero_ils.query:and_search_factory' + search_factory_imp='rero_ils.query:and_search_factory', ), doc_csv=dict( pid_type='doc', @@ -292,19 +300,19 @@ def _(x): 'text/csv': ( 'rero_ils.modules.documents_items.serializers' ':documents_items_csv_v1_response' - ), + ) }, search_serializers={ 'text/csv': ( 'rero_ils.modules.documents_items.serializers' ':documents_items_csv_v1_search' - ), + ) }, list_route='/export/documents/csv/', item_route='/export/documents/csv/', default_media_type='text/csv', max_result_window=20000, - search_factory_imp='rero_ils.query:and_search_factory' + search_factory_imp='rero_ils.query:and_search_factory', ), org=dict( pid_type='org', @@ -314,22 +322,26 @@ def _(x): search_index='organisations', search_type=None, record_serializers={ - 'application/rero+json': ('rero_ils.modules.serializers' - ':json_v1_search'), - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_response'), + 'application/rero+json': ( + 'rero_ils.modules.serializers' ':json_v1_search' + ), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_response' + ), }, search_serializers={ - 'application/rero+json': ('rero_ils.modules.serializers' - ':json_v1_search'), - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_search'), + 'application/rero+json': ( + 'rero_ils.modules.serializers' ':json_v1_search' + ), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_search' + ), }, list_route='/organisations/', item_route='/organisations/', default_media_type='application/json', max_result_window=10000, - search_factory_imp='rero_ils.query:and_search_factory' + search_factory_imp='rero_ils.query:and_search_factory', ), item=dict( pid_type='item', @@ -339,20 +351,23 @@ def _(x): search_index='items', search_type=None, record_serializers={ - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_response'), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_response' + ) }, search_serializers={ - 'application/rero+json': ('rero_ils.modules.serializers' - ':json_v1_search'), - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_search'), + 'application/rero+json': ( + 'rero_ils.modules.serializers' ':json_v1_search' + ), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_search' + ), }, list_route='/items/', item_route='/items/', default_media_type='application/json', max_result_window=10000, - search_factory_imp='rero_ils.query:and_search_factory' + search_factory_imp='rero_ils.query:and_search_factory', ), itty=dict( pid_type='itty', @@ -362,20 +377,23 @@ def _(x): search_index='items_types', search_type=None, record_serializers={ - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_response'), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_response' + ) }, search_serializers={ - 'application/rero+json': ('rero_ils.modules.serializers' - ':json_v1_search'), - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_search'), + 'application/rero+json': ( + 'rero_ils.modules.serializers' ':json_v1_search' + ), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_search' + ), }, list_route='/items_types/', item_route='/items_types/', default_media_type='application/json', max_result_window=10000, - search_factory_imp='rero_ils.query:and_search_factory' + search_factory_imp='rero_ils.query:and_search_factory', ), ptrn=dict( pid_type='ptrn', @@ -385,20 +403,23 @@ def _(x): search_index='patrons', search_type=None, record_serializers={ - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_response'), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_response' + ) }, search_serializers={ - 'application/rero+json': ('rero_ils.modules.serializers' - ':json_v1_search'), - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_search'), + 'application/rero+json': ( + 'rero_ils.modules.serializers' ':json_v1_search' + ), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_search' + ), }, list_route='/patrons/', item_route='/patrons/', default_media_type='application/json', max_result_window=10000, - search_factory_imp='rero_ils.query:and_search_factory' + search_factory_imp='rero_ils.query:and_search_factory', ), ptty=dict( pid_type='ptty', @@ -408,20 +429,23 @@ def _(x): search_index='patrons_types', search_type=None, record_serializers={ - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_response'), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_response' + ) }, search_serializers={ - 'application/rero+json': ('rero_ils.modules.serializers' - ':json_v1_search'), - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_search'), + 'application/rero+json': ( + 'rero_ils.modules.serializers' ':json_v1_search' + ), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_search' + ), }, list_route='/patrons_types/', item_route='/patrons_types/', default_media_type='application/json', max_result_window=10000, - search_factory_imp='rero_ils.query:and_search_factory' + search_factory_imp='rero_ils.query:and_search_factory', ), lib=dict( pid_type='lib', @@ -431,20 +455,23 @@ def _(x): search_index='libraries', search_type=None, record_serializers={ - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_response'), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_response' + ) }, search_serializers={ - 'application/rero+json': ('rero_ils.modules.serializers' - ':json_v1_search'), - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_search'), + 'application/rero+json': ( + 'rero_ils.modules.serializers' ':json_v1_search' + ), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_search' + ), }, list_route='/libraries/', item_route='/libraries/', default_media_type='application/json', max_result_window=10000, - search_factory_imp='rero_ils.query:and_search_factory' + search_factory_imp='rero_ils.query:and_search_factory', ), loc=dict( pid_type='loc', @@ -454,20 +481,23 @@ def _(x): search_index='locations', search_type=None, record_serializers={ - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_response'), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_response' + ) }, search_serializers={ - 'application/rero+json': ('rero_ils.modules.serializers' - ':json_v1_search'), - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_search'), + 'application/rero+json': ( + 'rero_ils.modules.serializers' ':json_v1_search' + ), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_search' + ), }, list_route='/locations/', item_route='/locations/', default_media_type='application/json', max_result_window=10000, - search_factory_imp='rero_ils.query:and_search_factory' + search_factory_imp='rero_ils.query:and_search_factory', ), pers=dict( pid_type='pers', @@ -477,20 +507,23 @@ def _(x): search_index='persons', search_type=None, record_serializers={ - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_response'), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_response' + ) }, search_serializers={ - 'application/rero+json': ('rero_ils.modules.serializers' - ':json_v1_search'), - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_search'), + 'application/rero+json': ( + 'rero_ils.modules.serializers' ':json_v1_search' + ), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_search' + ), }, list_route='/persons/', item_route='/persons/', default_media_type='application/json', max_result_window=10000, - search_factory_imp='rero_ils.query:and_search_factory' + search_factory_imp='rero_ils.query:and_search_factory', ), cipo=dict( pid_type='cipo', @@ -500,39 +533,42 @@ def _(x): search_index='circ_policies', search_type=None, record_serializers={ - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_response'), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_response' + ) }, search_serializers={ - 'application/rero+json': ('rero_ils.modules.serializers' - ':json_v1_search'), - 'application/json': ('invenio_records_rest.serializers' - ':json_v1_search'), + 'application/rero+json': ( + 'rero_ils.modules.serializers' ':json_v1_search' + ), + 'application/json': ( + 'invenio_records_rest.serializers' ':json_v1_search' + ), }, list_route='/circ_policies/', item_route='/circ_policies/', default_media_type='application/json', max_result_window=10000, - search_factory_imp='rero_ils.query:and_search_factory' - ) + search_factory_imp='rero_ils.query:and_search_factory', + ), ) SEARCH_UI_SEARCH_INDEX = 'documents' RERO_ILS_APP_CONFIG_FACETS = { 'documents': { - 'order': ['document_type', 'library', 'author', 'language', 'subject', - 'status'], - 'expand': ['document_type'] - }, - 'patrons': { - 'order': ['roles'], - 'expand': ['roles'] - }, - 'persons': { - 'order': ['sources'], - 'expand': ['sources'] + 'order': [ + 'document_type', + 'library', + 'author', + 'language', + 'subject', + 'status', + ], + 'expand': ['document_type'], }, + 'patrons': {'order': ['roles'], 'expand': ['roles']}, + 'persons': {'order': ['sources'], 'expand': ['sources']}, } RECORDS_REST_FACETS = { @@ -540,20 +576,12 @@ def _(x): aggs=dict( years=dict( date_histogram=dict( - field='publicationYear', - interval='year', - format='yyyy', - ) - ), - document_type=dict( - terms=dict( - field='type', + field='publicationYear', interval='year', format='yyyy' ) ), + document_type=dict(terms=dict(field='type')), library=dict( - terms=dict( - field='itemslist.library_name', - ), + terms=dict(field='itemslist.library_name'), # aggs=dict( # location=dict( # terms=dict( @@ -562,26 +590,10 @@ def _(x): # ) # ) ), - author=dict( - terms=dict( - field='facet_authors', - ) - ), - language=dict( - terms=dict( - field='languages.language', - ) - ), - subject=dict( - terms=dict( - field='subject', - ) - ), - status=dict( - terms=dict( - field='itemslist._circulation.status', - ) - ), + author=dict(terms=dict(field='facet_authors')), + language=dict(terms=dict(field='languages.language')), + subject=dict(terms=dict(field='subject')), + status=dict(terms=dict(field='itemslist._circulation.status')), ), # can be also post_filter filters={ @@ -590,61 +602,39 @@ def _(x): _('author'): terms_filter('facet_authors'), _('language'): terms_filter('languages.language'), _('subject'): terms_filter('subject'), - _('status'): terms_filter('itemslist._circulation.status') + _('status'): terms_filter('itemslist._circulation.status'), }, post_filters={ _('years'): range_filter( - 'publicationYear', - format='yyyy', - end_date_math='/y' + 'publicationYear', format='yyyy', end_date_math='/y' ) - } + }, ), 'patrons': dict( - aggs=dict( - roles=dict( - terms=dict( - field='roles', - ) - ) - ), - filters={ - _('roles'): terms_filter('roles') - } + aggs=dict(roles=dict(terms=dict(field='roles'))), + filters={_('roles'): terms_filter('roles')}, ), 'persons': dict( - aggs=dict( - sources=dict( - terms=dict( - field='sources', - ) - ) - ), - filters={ - _('sources'): terms_filter('sources') - } - ) + aggs=dict(sources=dict(terms=dict(field='sources'))), + filters={_('sources'): terms_filter('sources')}, + ), } # sort RECORDS_REST_SORT_OPTIONS = { 'documents': dict( bestmatch=dict( - fields=['_score'], - title='Best match', - default_order='asc' + fields=['_score'], title='Best match', default_order='asc' ), mostrecent=dict( - fields=['-_created'], - title='Most recent', - default_order='desc' + fields=['-_created'], title='Most recent', default_order='desc' ), ) } # default sort RECORDS_REST_DEFAULT_SORT = { - 'documents': dict(query='bestmatch', noquery='mostrecent'), + 'documents': dict(query='bestmatch', noquery='mostrecent') } # Detailed View Configuration @@ -655,7 +645,7 @@ def _(x): route='/documents/', template='rero_ils/detailed_view_documents_items.html', view_imp='rero_ils.modules.documents_items.views.doc_item_view_method', - record_class='rero_ils.modules.documents_items.api:DocumentsWithItems' + record_class='rero_ils.modules.documents_items.api:DocumentsWithItems', ), 'doc_export': dict( pid_type='doc', @@ -669,21 +659,21 @@ def _(x): route='/organisations/', template='rero_ils/detailed_view_organisations_libraries.html', record_class='rero_ils.modules.organisations_libraries.api:OrganisationWithLibraries', - permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory' + permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory', ), 'lib': dict( pid_type='lib', route='/libraries/', template='rero_ils/detailed_view_libraries_locations.html', record_class='rero_ils.modules.libraries_locations.api:LibraryWithLocations', - permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory' + permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory', ), 'loc': dict( pid_type='loc', route='/locations/', template='rero_ils/detailed_view_locations.html', record_class='rero_ils.modules.locations.api:Location', - permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory' + permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory', ), 'item': dict( pid_type='item', @@ -691,29 +681,28 @@ def _(x): template='rero_ils/detailed_view_items.html', view_imp='rero_ils.modules.items.views.item_view_method', record_class='rero_ils.modules.items.api:Item', - permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory' + permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory', ), 'itty': dict( pid_type='itty', route='/items_types/', template='rero_ils/detailed_view_items_types.html', record_class='rero_ils.modules.items_types.api:ItemType', - permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory' + permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory', ), 'ptrn': dict( pid_type='ptrn', route='/patrons/', template='rero_ils/detailed_view_patrons.html', record_class='rero_ils.modules.patrons.api:Patron', - permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory' - + permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory', ), 'ptty': dict( pid_type='ptty', route='/patrons_types/', template='rero_ils/detailed_view_patrons_types.html', record_class='rero_ils.modules.patrons_types.api:PatronType', - permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory' + permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory', ), 'pers': dict( pid_type='pers', @@ -726,16 +715,15 @@ def _(x): route='/circ_policies/', template='rero_ils/detailed_view_circ_policies.html', record_class='rero_ils.modules.circ_policies.api:CircPolicy', - permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory' - ) + permission_factory_imp='rero_ils.permissions.cataloguer_permission_factory', + ), } RECORDS_UI_EXPORT_FORMATS = { 'doc': { 'json': dict( title='JSON', - serializer='invenio_records_rest.serializers' - ':json_v1', + serializer='invenio_records_rest.serializers' ':json_v1', order=1, ) } @@ -750,37 +738,45 @@ def _(x): results_template='templates/rero_ils/brief_view_documents_items.html', editor_template='rero_ils/document_editor.html', schema='documents/document-v0.0.1.json', - form_options=('rero_ils.modules.documents.form_options', - 'documents/document-v0.0.1.json'), + form_options=( + 'rero_ils.modules.documents.form_options', + 'documents/document-v0.0.1.json', + ), record_class=DocumentsWithItems, - form_options_create_exclude=['pid'] + form_options_create_exclude=['pid'], ), _('item'): dict( editor_template='rero_ils/item_editor.html', schema='items/item-v0.0.1.json', - form_options=('rero_ils.modules.items.form_options', - 'items/item-v0.0.1.json'), + form_options=( + 'rero_ils.modules.items.form_options', + 'items/item-v0.0.1.json', + ), save_record='rero_ils.modules.documents_items.utils:save_item', delete_record='rero_ils.modules.documents_items.utils:delete_item', record_class=Item, - form_options_create_exclude=['pid'] + form_options_create_exclude=['pid'], ), _('itty'): dict( api='/api/items_types/', schema='items_types/item_type-v0.0.1.json', - form_options=('rero_ils.modules.items_types.form_options', - 'items_types/item_type-v0.0.1.json'), + form_options=( + 'rero_ils.modules.items_types.form_options', + 'items_types/item_type-v0.0.1.json', + ), save_record='rero_ils.modules.items_types.utils:save_item_type', editor_template='rero_ils/item_type_editor.html', results_template='templates/rero_ils/brief_view_items_types.html', record_class=ItemType, - form_options_create_exclude=['pid', 'organisation_pid'] + form_options_create_exclude=['pid', 'organisation_pid'], ), _('ptrn'): dict( api='/api/patrons/', schema='patrons/patron-v0.0.1.json', - form_options=('rero_ils.modules.patrons.form_options', - 'patrons/patron-v0.0.1.json'), + form_options=( + 'rero_ils.modules.patrons.form_options', + 'patrons/patron-v0.0.1.json', + ), save_record='rero_ils.modules.patrons.utils:save_patron', editor_template='rero_ils/patron_editor.html', results_template='templates/rero_ils/brief_view_patrons.html', @@ -789,63 +785,75 @@ def _(x): _('ptty'): dict( api='/api/patrons_types/', schema='patrons_types/patron_type-v0.0.1.json', - form_options=('rero_ils.modules.patrons_types.form_options', - 'patrons_types/patron_type-v0.0.1.json'), + form_options=( + 'rero_ils.modules.patrons_types.form_options', + 'patrons_types/patron_type-v0.0.1.json', + ), save_record='rero_ils.modules.patrons_types.utils:save_patron_type', editor_template='rero_ils/patron_type_editor.html', results_template='templates/rero_ils/brief_view_patrons_types.html', record_class=PatronType, - form_options_create_exclude=['pid', 'organisation_pid'] + form_options_create_exclude=['pid', 'organisation_pid'], ), _('org'): dict( schema='organisations/organisation-v0.0.1.json', - form_options=('rero_ils.modules.organisations.form_options', - 'organisations/organisation-v0.0.1.json'), + form_options=( + 'rero_ils.modules.organisations.form_options', + 'organisations/organisation-v0.0.1.json', + ), record_class=OrganisationWithLibraries, - form_options_create_exclude=['pid'] + form_options_create_exclude=['pid'], ), _('lib'): dict( api='/api/libraries/', results_template='templates/rero_ils/brief_view_libraries_locations.html', editor_template='rero_ils/library_editor.html', schema='libraries/library-v0.0.1.json', - form_options=('rero_ils.modules.libraries.form_options', - 'libraries/library-v0.0.1.json'), + form_options=( + 'rero_ils.modules.libraries.form_options', + 'libraries/library-v0.0.1.json', + ), save_record='rero_ils.modules.organisations_libraries.utils:save_library', delete_record='rero_ils.modules.organisations_libraries.utils:delete_library', record_class=LibraryWithLocations, - form_options_create_exclude=['pid'] + form_options_create_exclude=['pid'], ), _('loc'): dict( editor_template='rero_ils/location_editor.html', schema='locations/location-v0.0.1.json', - form_options=('rero_ils.modules.locations.form_options', - 'locations/location-v0.0.1.json'), + form_options=( + 'rero_ils.modules.locations.form_options', + 'locations/location-v0.0.1.json', + ), save_record='rero_ils.modules.libraries_locations.utils:save_location', delete_record='rero_ils.modules.libraries_locations.utils:delete_location', record_class=Location, - form_options_create_exclude=['pid'] + form_options_create_exclude=['pid'], ), _('pers'): dict( api='/api/persons/', results_template='templates/rero_ils/brief_view_mef_persons.html', editor_template='rero_ils/document_editor.html', schema='persons/mef-person-v0.0.1.json', - form_options=('rero_ils.modules.documents.form_options', - 'persons/mef-person-v0.0.1.json'), + form_options=( + 'rero_ils.modules.documents.form_options', + 'persons/mef-person-v0.0.1.json', + ), record_class=MefPerson, - can_create=lambda: False + can_create=lambda: False, ), _('cipo'): dict( api='/api/circ_policies/', schema='circ_policies/circ_policy-v0.0.1.json', - form_options=('rero_ils.modules.circ_policies.form_options', - 'circ_policies/circ_policy-v0.0.1.json'), + form_options=( + 'rero_ils.modules.circ_policies.form_options', + 'circ_policies/circ_policy-v0.0.1.json', + ), save_record='rero_ils.modules.circ_policies.utils:save_circ_policy', editor_template='rero_ils/circ_policy_editor.html', results_template='templates/rero_ils/brief_view_circ_policies.html', record_class=CircPolicy, - form_options_create_exclude=['pid', 'organisation_pid'] + form_options_create_exclude=['pid', 'organisation_pid'], ), } @@ -877,8 +885,13 @@ def _(x): # RERO Specific Configuration # =========================== RERO_ILS_BABEL_TRANSLATE_JSON_KEYS = [ - 'title', 'description', 'placeholder', - 'validationMessage', 'name', 'add', '403' + 'title', + 'description', + 'placeholder', + 'validationMessage', + 'name', + 'add', + '403', ] RERO_ILS_PERMALINK_RERO_URL = 'http://data.rero.ch/01-{identifier}' @@ -890,12 +903,11 @@ def _(x): #: RERO_ILS specific configurations. -RERO_ILS_APP_IMPORT_BNF_EAN = 'http://catalogue.bnf.fr/api/SRU?'\ - 'version=1.2&operation=searchRetrieve'\ - '&recordSchema=unimarcxchange&maximumRecords=1'\ - '&startRecord=1&query=bib.ean%%20all%%20"%s"' +RERO_ILS_APP_IMPORT_BNF_EAN = 'http://catalogue.bnf.fr/api/SRU?' 'version=1.2&operation=searchRetrieve' '&recordSchema=unimarcxchange&maximumRecords=1' '&startRecord=1&query=bib.ean%%20all%%20"%s"' -RERO_ILS_APP_HELP_PAGE = 'https://github.com/rero/rero-ils/wiki/Public-demo-help' +RERO_ILS_APP_HELP_PAGE = ( + 'https://github.com/rero/rero-ils/wiki/Public-demo-help' +) #: Cover service RERO_ILS_THUMBNAIL_SERVICE_URL = 'https://services.test.rero.ch/cover' @@ -907,8 +919,88 @@ def _(x): RERO_ILS_PERSONS_LABEL_ORDER = { 'fallback': 'fr', 'fr': ['rero', 'bnf', 'gnd'], - 'de': ['gnd', 'rero', 'bnf'] + 'de': ['gnd', 'rero', 'bnf'], } ADMIN_PERMISSION_FACTORY = 'rero_ils.permissions.admin_permission_factory' ADMIN_BASE_TEMPLATE = BASE_TEMPLATE + + +#: Invenio circulation configuration. +CIRCULATION_ITEM_EXISTS = Item.get_record_by_pid +CIRCULATION_PATRON_EXISTS = Patron.get_record_by_pid +CIRCULATION_STATES_ITEM_AVAILABLE = [ + 'ITEM_RETURNED', + 'CANCELLED', + 'ITEM_AT_DESK', + 'PENDING', +] +CIRCULATION_ITEM_LOCATION_RETRIEVER = Item.item_location_retriever +CIRCULATION_DOCUMENT_RETRIEVER_FROM_ITEM = ( + DocumentsWithItems.document_retriever +) +CIRCULATION_ITEMS_RETRIEVER_FROM_DOCUMENT = DocumentsWithItems.items_retriever + +CIRCULATION_LOAN_TRANSITIONS = { + 'CREATED': [ + dict(dest='PENDING', trigger='request', transition=CreatedToPending), + dict( + dest='ITEM_ON_LOAN', + trigger='checkout', + transition=CreatedToItemOnLoan, + ), + ], + 'PENDING': [ + dict( + dest='ITEM_AT_DESK', + transition=PendingToItemAtDesk, + trigger='validate', + ), + dict( + dest='ITEM_IN_TRANSIT_FOR_PICKUP', + transition=PendingToItemInTransitPickup, + trigger='validate', + ), + dict(dest='CANCELLED', trigger='cancel'), + ], + 'ITEM_AT_DESK': [ + dict( + dest='ITEM_ON_LOAN', + transition=ItemAtDeskToItemOnLoan, + trigger='checkout', + ), + dict(dest='CANCELLED', trigger='cancel'), + ], + 'ITEM_IN_TRANSIT_FOR_PICKUP': [ + dict(dest='ITEM_AT_DESK', trigger='receive'), + dict(dest='CANCELLED', trigger='cancel'), + ], + 'ITEM_ON_LOAN': [ + dict( + dest='ITEM_RETURNED', + transition=ItemOnLoanToItemReturned, + trigger='checkin', + ), + dict( + dest='ITEM_IN_TRANSIT_TO_HOUSE', + transition=ItemOnLoanToItemInTransitHouse, + trigger='checkin', + ), + dict( + dest='ITEM_ON_LOAN', + transition=ItemOnLoanToItemOnLoan, + trigger='extend', + ), + dict(dest='CANCELLED', trigger='cancel'), + ], + 'ITEM_IN_TRANSIT_TO_HOUSE': [ + dict( + dest='ITEM_RETURNED', + transition=ItemInTransitHouseToItemReturned, + trigger='checkin', + ), + dict(dest='CANCELLED', trigger='cancel'), + ], + 'ITEM_RETURNED': [], + 'CANCELLED': [], +} diff --git a/rero_ils/modules/documents_items/api.py b/rero_ils/modules/documents_items/api.py index d9c6ff6a96..e9a1f53e3d 100644 --- a/rero_ils/modules/documents_items/api.py +++ b/rero_ils/modules/documents_items/api.py @@ -134,3 +134,22 @@ def get_document_by_itemid(cls, id_, with_deleted=False): return super(DocumentsWithItems, cls).get_record_by_elementid( id_, with_deleted ) + + @classmethod + def document_retriever(cls, item_pid, **kwargs): + """Retrieve document pid from item pid.""" + document_pid = '' + if Item.get_record_by_pid(item_pid): + id = Item.get_record_by_pid(item_pid).id + document_pid = cls.get_document_by_itemid(id).pid + return document_pid + + @classmethod + def items_retriever(cls, document_pid): + """Retrieve item pids by document pid.""" + item_pids = [] + if cls.get_record_by_pid(document_pid): + document = cls.get_record_by_pid(document_pid) + for item in document.itemslist: + item_pids.append(item.get('pid')) + return item_pids diff --git a/rero_ils/modules/items/api.py b/rero_ils/modules/items/api.py index ded0a237af..4c637e8744 100644 --- a/rero_ils/modules/items/api.py +++ b/rero_ils/modules/items/api.py @@ -527,3 +527,13 @@ def loaned_to_patron(self, patron_barcode): if holding['patron_barcode'] == patron_barcode: return True return False + + @classmethod + def item_location_retriever(cls, item_pid, **kwargs): + """Get item location.""" + location_pid = '' + if cls.get_record_by_pid(item_pid): + item = cls.get_record_by_pid(item_pid) + if item.get('location_pid'): + location_pid = item.get('location_pid') + return location_pid