Projet

Général

Profil

0001-lingo-return-empty-list-if-retrieving-invoice-fails-.patch

Benjamin Dauvergne, 12 juin 2020 10:40

Télécharger (1,23 ko)

Voir les différences:

Subject: [PATCH] lingo: return empty list if retrieving invoice fails (#43967)

 combo/apps/lingo/models.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
combo/apps/lingo/models.py
173 173
            url = self.webservice_url + '/invoices/'
174 174
            if history:
175 175
                url += 'history/'
176
            items = requests.get(url, user=user, remote_service='auto', cache_duration=0).json()
176
            try:
177
                response = requests.get(url, user=user, remote_service='auto', cache_duration=0)
178
                response.raise_for_status()
179
            except requests.RequestException:
180
                # already logged by log errors if status != 2xx
181
                return []
182
            items = response.json()
177 183
            if items.get('data'):
178 184
                return [build_remote_item(item, self) for item in items.get('data')]
179 185
            return []
180
-