[datafeed] also catch EnvironmentError when trying to load the cwclientlib config file
authorDavid Douard <david.douard@logilab.fr>
Fri, 10 Jul 2015 09:30:04 +0200
changeset 10532 2cc74c688eb9
parent 10531 51261952d068
child 10533 78a0ac371736
[datafeed] also catch EnvironmentError when trying to load the cwclientlib config file means the config file has not been found, so fall back to the old implementation instead of crashing.
server/sources/datafeed.py
--- a/server/sources/datafeed.py	Fri Jul 10 09:35:52 2015 +0200
+++ b/server/sources/datafeed.py	Fri Jul 10 09:30:04 2015 +0200
@@ -345,9 +345,10 @@
             resp = cnx.get(url)
             resp.raise_for_status()
             return URLLibResponseAdapter(StringIO.StringIO(resp.text), url)
-        except (ImportError, ValueError) as exc:
+        except (ImportError, ValueError, EnvironmentError) as exc:
             # ImportError: not available
             # ValueError: no config entry found
+            # EnvironmentError: no cwclientlib config file found
             self.source.debug(str(exc))
 
         # no chance with cwclientlib, fall back to former implementation
@@ -522,9 +523,10 @@
             cnx.timeout = self.source.http_timeout
             self.source.info('Using cwclientlib for checking %s' % url)
             return cnx.get(url).status_code == 404
-        except (ImportError, ValueError) as exc:
+        except (ImportError, ValueError, EnvironmentError) as exc:
             # ImportError: not available
             # ValueError: no config entry found
+            # EnvironmentError: no cwclientlib config file found
             self.source.debug(str(exc))
 
         # no chance with cwclientlib, fall back to former implementation