cubicweb/devtools/testlib.py
branch3.26
changeset 12577 2508ba96fad2
parent 12250 afc678253bc2
child 12591 f5f83d72ba8d
child 12719 9fb4a71f119d
--- a/cubicweb/devtools/testlib.py	Fri Apr 05 17:40:02 2019 +0200
+++ b/cubicweb/devtools/testlib.py	Tue Apr 16 15:49:03 2019 +0200
@@ -479,10 +479,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 #########################################################