[devtools/testlib] avoid hidding AttributeError in create_user()
commit() might raise a AttributeError too.
Use getattr(req, 'cnx', req) instead, which is a form already used to get the real cnx
in some code:
cubicweb/rset.py:577: cnx = getattr(self.req, 'cnx', self.req)
cubicweb/schema.py:353: with getattr(_cw, 'cnx', _cw).security_enabled(read=False):
We could use if hasattr(req, 'commit') here too but it lead to 3 additionals lines.
Maybe we should have commit() and rollback() on
cubicweb.web.request.ConnectionCubicWebRequestBase too ?
from os import unlink
from os.path import isfile, join
from cubicweb.cwconfig import CubicWebConfiguration as cwcfg
regdir = cwcfg.instances_dir()
if isfile(join(regdir, 'startorder')):
if confirm('The startorder file is not used anymore in Cubicweb 3.22. '
'Should I delete it?',
shell=False, pdb=False):
unlink(join(regdir, 'startorder'))