# HG changeset patch # User Philippe Pepiot # Date 1557496681 -7200 # Node ID f5f83d72ba8d4570826ed74def6b75f38225bfee # Parent a5d7fcde74c9e0ea129c957955ae5792c94de1a2# Parent afafc8fd9a45fb4208a8207f127fb26253b56373 Merge 3.26 This fixes tests with psycopg2 diff -r a5d7fcde74c9 -r f5f83d72ba8d cubicweb/devtools/testlib.py --- a/cubicweb/devtools/testlib.py Wed May 08 21:37:13 2019 +0200 +++ b/cubicweb/devtools/testlib.py Fri May 10 15:58:01 2019 +0200 @@ -446,10 +446,7 @@ reverse_primary_email=user) user.cw_clear_relation_cache('in_group', 'subject') if commit: - try: - req.commit() # req is a session - except AttributeError: - req.cnx.commit() + getattr(req, 'cnx', req).commit() return user # other utilities ######################################################### diff -r a5d7fcde74c9 -r f5f83d72ba8d cubicweb/pyramid/config.py diff -r a5d7fcde74c9 -r f5f83d72ba8d cubicweb/server/sources/native.py --- a/cubicweb/server/sources/native.py Wed May 08 21:37:13 2019 +0200 +++ b/cubicweb/server/sources/native.py Fri May 10 15:58:01 2019 +0200 @@ -690,7 +690,8 @@ self.debug('transaction has been rolled back') except Exception: pass - if ex.__class__.__name__ == 'IntegrityError': + if any(cls.__name__ for cls in ex.__class__.__mro__ + if cls.__name__ == 'IntegrityError'): # need string comparison because of various backends for arg in ex.args: # postgres, sqlserver