=== modified file 'Koo/koopos.py' --- Koo/koopos.py 2009-07-07 13:51:07 +0000 +++ Koo/koopos.py 2009-07-31 15:34:35 +0000 @@ -1,5 +1,5 @@ #!/usr/bin/python - +# -*- coding: utf-8 -*- ############################################################################## # # Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved. @@ -106,9 +106,22 @@ import Pos app.installEventFilter( Pos.PosEventFilter(mainWindow) ) +# Use URL from argument to connect with POS mode +url = QUrl(Options.options['login.url']) +if not url.isValid() or unicode(url.password()) == '': + print 'The URL seem not to be valid, or password missing\nurl: %s' % (url.toString(),) + sys.exit(1) + +oerpurl = '%s://%s:%s@%s:%s' % (unicode(url.scheme()), unicode(url.userName()), unicode(url.password()) , unicode(url.host()), unicode(url.port()),) +oerpdb = '%s' % url.path().replace('/','') + # Load default wizard -Rpc.session.login( 'PYROLOC://admin:admin@localhost:8071', 'test' ) -id = Rpc.session.execute('/object', 'execute', 'res.users', 'read', [Rpc.session.uid], ['menu_id','name'], Rpc.session.context) +Rpc.session.login( oerpurl, oerpdb) +try: + id = Rpc.session.execute('/object', 'execute', 'res.users', 'read', [Rpc.session.uid], ['menu_id','name'], Rpc.session.context) +except Rpc.RpcException, e: + print '%s: %s - %s' % (e.type.upper(), e.message, e.data,) + sys.exit(2) # Store the menuId so we ensure we don't open the menu twice when # calling openHomeTab() @@ -118,3 +131,4 @@ app.exec_() +# vim:noexpandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: