[FIX] osv: Bad error message
authorCecile Tonglet <cto@openerp.com>
Wed, 13 Feb 2013 13:34:51 +0000 (14:34 +0100)
committerCecile Tonglet <cto@openerp.com>
Wed, 13 Feb 2013 13:34:51 +0000 (14:34 +0100)
bzr revid: cto@openerp.com-20130213133451-3e84dzvlhcbv0130

bin/osv/osv.py

index efc2e75..938ec30 100644 (file)
@@ -129,7 +129,9 @@ class object_proxy(netsvc.Service):
                     return f(self, dbname, *args, **kwargs)
                 except OperationalError, e:
                     # Automatically retry the typical transaction serialization errors
-                    if not e.pgcode in PG_CONCURRENCY_ERRORS_TO_RETRY or tries >= MAX_TRIES_ON_CONCURRENCY_FAILURE:
+                    if e.pgcode not in PG_CONCURRENCY_ERRORS_TO_RETRY:
+                        raise
+                    if tries >= MAX_TRIES_ON_CONCURRENCY_FAILURE:
                         self.logger.warning("%s, maximum number of tries reached" % errorcodes.lookup(e.pgcode))
                         raise
                     wait_time = random.uniform(0.0, 2 ** tries)