On 08 Aug 12:45, fabien.castar...@gmail.com wrote: > Hi, > > I'm working on a script aimed to create a new Tryton database via XML-RPC. > Here it is : > > from datetime import datetime > > import xmlrpclib > import pprint > > TRYTON_SERVER = u'http://localhost:8069/' > TRYTON_ADMIN_PASSWORD = u'admin' > NEW_DB_LANG = u'fr_FR' > NEW_DB_ADMIN_PASSWORD = u'admin' > > s = xmlrpclib.ServerProxy(TRYTON_SERVER, verbose=False, allow_none=True) > > now = datetime.now() > db_name = u'test_{}{}{}{}{}{}'.format(now.year, now.month, now.day, now.hour > , now.minute, now.second) > s.common.db.create( > > db_name, > TRYTON_ADMIN_PASSWORD, > NEW_DB_LANG, > NEW_DB_ADMIN_PASSWORD) > > The database creation works, and trytond logs : INFO:database:CREATE DB: > test_201488192720. But just after, it logs : INFO:pool:init pool for "", > and the xmlrpclib raises a Fault exception, so the script aborts. > > This is due to the security.logout(database_name, user, session) call in > _dispatch() function of the GenericXMLRPCRequestHandler class, at the line > 169 in /protocols/xmlrpc.py > <http://hg.tryton.org/trytond/file/afd0ba474873/trytond/protocols/xmlrpc.py#l169> > . > > For JSON-RPC, there is not call to security.logout() in > GenericJSONRPCRequestHandler > class > <http://hg.tryton.org/trytond/file/afd0ba474873/trytond/protocols/jsonrpc.py#l170> > . > > Is there any reason, or we could remove this call ?
The logout is there because XML-RPC doesn't support persistant session so we create a temporary session in line 191. But I agree that it should not logout in case the session was not created. Please report an issue. -- Cédric Krier - B2CK SPRL Email/Jabber: cedric.kr...@b2ck.com Tel: +32 472 54 46 59 Website: http://www.b2ck.com/
pgpj9HiMz_a4L.pgp
Description: PGP signature