[transaction] explicit Transaction cnxset attribute
The Transaction object have a lot more attribute that those previously declared
in __init__. They are just dynamically assigned in Session code.
This changeset explicit the ``cnxset`` and ``mode`` attribute declaration.
frombase64importb64decode,b64encodetry:uri,newdn=__args__exceptValueError:print'USAGE: cubicweb-ctl shell <instance> ldap_change_base_dn.py -- <ldap source uri> <new dn>'printprint'you should not have updated your sources file yet'olddn=repo.config.sources()[uri]['user-base-dn']assertolddn!=newdnraw_input("Ensure you've stopped the instance, type enter when done.")foreid,extidinsql("SELECT eid, extid FROM entities WHERE source='%s'"%uri):olduserdn=b64decode(extid)newuserdn=olduserdn.replace(olddn,newdn)ifnewuserdn!=olduserdn:printolduserdn,'->',newuserdnsql("UPDATE entities SET extid='%s' WHERE eid=%s"%(b64encode(newuserdn),eid))commit()print'you can now update the sources file to the new dn and restart the instance'