From 7f8d7a6d800e2f666134257c084b4c807927b907 Mon Sep 17 00:00:00 2001 From: Ludovic LANGE Date: Mon, 4 Jan 2021 10:02:34 +0100 Subject: [PATCH] [cesu] Do not download unavailable documents Some documents are not ready to be downloaded, and when trying to download them it results in a 500 error. When now apply the same logic as in the site to decide if a document should be listed or not. --- modules/cesu/pages.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/cesu/pages.py b/modules/cesu/pages.py index f0dd3958a0..3197644cab 100644 --- a/modules/cesu/pages.py +++ b/modules/cesu/pages.py @@ -36,6 +36,7 @@ Format, Field, BrowserURL, + Lower, ) @@ -119,6 +120,10 @@ class iter_documents(DictElement): item_xpath = "listeObjets" class item(ItemElement): + + def condition(self): + return Lower(CleanText(Dict('isTelechargeable')))(self.el) == 'true' + klass = Document obj_id = Format("%s_%s", Env("subscription"), Dict("referenceDocumentaire")) -- GitLab