[datafeed] propagate raise_on_error to parser's process method
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 16 May 2011 10:17:48 +0200
changeset 7385 29f050e39b09
parent 7383 1719eab69551
child 7386 206890413858
[datafeed] propagate raise_on_error to parser's process method
server/sources/datafeed.py
--- a/server/sources/datafeed.py	Fri May 13 18:47:03 2011 +0200
+++ b/server/sources/datafeed.py	Mon May 16 10:17:48 2011 +0200
@@ -138,7 +138,7 @@
         self.info('pulling data for source %s', self.uri)
         for url in self.urls:
             try:
-                if parser.process(url):
+                if parser.process(url, raise_on_error):
                     error = True
             except IOError, exc:
                 if raise_on_error:
@@ -247,7 +247,7 @@
 
 class DataFeedXMLParser(DataFeedParser):
 
-    def process(self, url, partialcommit=True):
+    def process(self, url, raise_on_error=False, partialcommit=True):
         """IDataFeedParser main entry point"""
         error = False
         for args in self.parse(url):
@@ -259,6 +259,8 @@
                     self._cw.commit()
                     self._cw.set_pool()
             except ValidationError, exc:
+                if raise_on_error:
+                    raise
                 if partialcommit:
                     self.source.error('Skipping %s because of validation error %s' % (args, exc))
                     self._cw.rollback()