[datafeed] fix/finish cleanup started by auc in 8393:c25b96ae4f8a: parser.process prototytpe is (url, raise_on_error=False). Drop partialcommit argument which were never specified
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 15 May 2012 14:44:45 +0200
changeset 8409 79534887943e
parent 8408 41461b2e9854
child 8410 eb6a607a0067
[datafeed] fix/finish cleanup started by auc in 8393:c25b96ae4f8a: parser.process prototytpe is (url, raise_on_error=False). Drop partialcommit argument which were never specified
server/sources/datafeed.py
sobjects/cwxmlparser.py
sobjects/ldapparser.py
--- a/server/sources/datafeed.py	Tue May 15 14:43:30 2012 +0200
+++ b/server/sources/datafeed.py	Tue May 15 14:44:45 2012 +0200
@@ -350,7 +350,7 @@
             self.sourceuris.pop(str(uri), None)
         return session.entity_from_eid(eid, etype)
 
-    def process(self, url, partialcommit=True):
+    def process(self, url, raise_on_error=False):
         """main callback: process the url"""
         raise NotImplementedError
 
@@ -391,7 +391,7 @@
 
 class DataFeedXMLParser(DataFeedParser):
 
-    def process(self, url, raise_on_error=False, partialcommit=True):
+    def process(self, url, raise_on_error=False):
         """IDataFeedParser main entry point"""
         try:
             parsed = self.parse(url)
@@ -413,21 +413,18 @@
         for args in parsed:
             try:
                 self.process_item(*args)
-                if partialcommit:
-                    # commit+set_cnxset instead of commit(free_cnxset=False) to let
-                    # other a chance to get our connections set
-                    commit()
-                    set_cnxset()
+                # commit+set_cnxset instead of commit(free_cnxset=False) to let
+                # other a chance to get our connections set
+                commit()
+                set_cnxset()
             except ValidationError, exc:
                 if raise_on_error:
                     raise
-                if partialcommit:
-                    self.source.error('Skipping %s because of validation error %s' % (args, exc))
-                    rollback()
-                    set_cnxset()
-                    error = True
-                else:
-                    raise
+                self.source.error('Skipping %s because of validation error %s'
+                                  % (args, exc))
+                rollback()
+                set_cnxset()
+                error = True
         return error
 
     def parse(self, url):
--- a/sobjects/cwxmlparser.py	Tue May 15 14:43:30 2012 +0200
+++ b/sobjects/cwxmlparser.py	Tue May 15 14:44:45 2012 +0200
@@ -183,11 +183,11 @@
 
     # import handling ##########################################################
 
-    def process(self, url, raise_on_error=False, partialcommit=True):
+    def process(self, url, raise_on_error=False):
         """IDataFeedParser main entry point"""
         if url.startswith('http'): # XXX similar loose test as in parse of sources.datafeed
             url = self.complete_url(url)
-        super(CWEntityXMLParser, self).process(url, raise_on_error, partialcommit)
+        super(CWEntityXMLParser, self).process(url, raise_on_error)
 
     def parse_etree(self, parent):
         for node in list(parent):
--- a/sobjects/ldapparser.py	Tue May 15 14:43:30 2012 +0200
+++ b/sobjects/ldapparser.py	Tue May 15 14:44:45 2012 +0200
@@ -35,7 +35,7 @@
     # attributes of the cw user
     non_attribute_keys = set(('email',))
 
-    def process(self, url, partialcommit=True):
+    def process(self, url, raise_on_error=False):
         """IDataFeedParser main entry point"""
         source = self.source
         searchstr = '(&%s)' % ''.join(source.base_filters)