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 ?

Thanks,

Fab.

Reply via email to