Accepted Uppercase DB names and displayed on terminal
bzr revid: jvo@tinyerp.com-20080911072945-jwo9wscd8ko66av9
This commit is contained in:
parent
619e95b4aa
commit
e26e2062b5
|
@ -44,7 +44,7 @@ def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False)
|
||||||
db = db_dic[db_name]
|
db = db_dic[db_name]
|
||||||
else:
|
else:
|
||||||
logger = netsvc.Logger()
|
logger = netsvc.Logger()
|
||||||
logger.notifyChannel('pooler', netsvc.LOG_INFO, 'Connecting to %s' % (db_name))
|
logger.notifyChannel('pooler', netsvc.LOG_INFO, 'Connecting to %s' % (db_name.lower()))
|
||||||
db = sql_db.db_connect(db_name)
|
db = sql_db.db_connect(db_name)
|
||||||
db_dic[db_name] = db
|
db_dic[db_name] = db
|
||||||
|
|
||||||
|
|
|
@ -87,9 +87,9 @@ class db(netsvc.Service):
|
||||||
cr = None
|
cr = None
|
||||||
pool = pooler.get_pool(db_name, demo, serv.actions[id],
|
pool = pooler.get_pool(db_name, demo, serv.actions[id],
|
||||||
update_module=True)
|
update_module=True)
|
||||||
|
|
||||||
cr = sql_db.db_connect(db_name).cursor()
|
cr = sql_db.db_connect(db_name).cursor()
|
||||||
|
|
||||||
if lang:
|
if lang:
|
||||||
modobj = pool.get('ir.module.module')
|
modobj = pool.get('ir.module.module')
|
||||||
mids = modobj.search(cr, 1, [('state', '=', 'installed')])
|
mids = modobj.search(cr, 1, [('state', '=', 'installed')])
|
||||||
|
@ -119,7 +119,7 @@ class db(netsvc.Service):
|
||||||
cr.close()
|
cr.close()
|
||||||
logger = netsvc.Logger()
|
logger = netsvc.Logger()
|
||||||
logger.notifyChannel("web-services", netsvc.LOG_INFO,
|
logger.notifyChannel("web-services", netsvc.LOG_INFO,
|
||||||
'CREATE DB: %s' % (db_name))
|
'CREATE DB: %s' % (db_name.lower()))
|
||||||
dbi = DBInitialize()
|
dbi = DBInitialize()
|
||||||
create_thread = threading.Thread(target=dbi,
|
create_thread = threading.Thread(target=dbi,
|
||||||
args=(self, id, db_name, demo, lang, user_password))
|
args=(self, id, db_name, demo, lang, user_password))
|
||||||
|
@ -280,7 +280,7 @@ class db(netsvc.Service):
|
||||||
tools.config['admin_passwd'] = new_password
|
tools.config['admin_passwd'] = new_password
|
||||||
tools.config.save()
|
tools.config.save()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def list_lang(self):
|
def list_lang(self):
|
||||||
return tools.scan_languages()
|
return tools.scan_languages()
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ class common(netsvc.Service):
|
||||||
res = security.login(db, login, password)
|
res = security.login(db, login, password)
|
||||||
logger = netsvc.Logger()
|
logger = netsvc.Logger()
|
||||||
msg = res and 'successful login' or 'bad login or password'
|
msg = res and 'successful login' or 'bad login or password'
|
||||||
logger.notifyChannel("web-service", netsvc.LOG_INFO, "%s from '%s' using database '%s'" % (msg, login, db))
|
logger.notifyChannel("web-service", netsvc.LOG_INFO, "%s from '%s' using database '%s'" % (msg, login, db.lower()))
|
||||||
return res or False
|
return res or False
|
||||||
|
|
||||||
def about(self, extended=False):
|
def about(self, extended=False):
|
||||||
|
@ -368,13 +368,13 @@ class objects_proxy(netsvc.Service):
|
||||||
self.exportMethod(self.execute)
|
self.exportMethod(self.execute)
|
||||||
self.exportMethod(self.exec_workflow)
|
self.exportMethod(self.exec_workflow)
|
||||||
self.exportMethod(self.obj_list)
|
self.exportMethod(self.obj_list)
|
||||||
|
|
||||||
def exec_workflow(self, db, uid, passwd, object, method, id):
|
def exec_workflow(self, db, uid, passwd, object, method, id):
|
||||||
security.check(db, uid, passwd)
|
security.check(db, uid, passwd)
|
||||||
service = netsvc.LocalService("object_proxy")
|
service = netsvc.LocalService("object_proxy")
|
||||||
res = service.exec_workflow(db, uid, object, method, id)
|
res = service.exec_workflow(db, uid, object, method, id)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def execute(self, db, uid, passwd, object, method, *args):
|
def execute(self, db, uid, passwd, object, method, *args):
|
||||||
security.check(db, uid, passwd)
|
security.check(db, uid, passwd)
|
||||||
service = netsvc.LocalService("object_proxy")
|
service = netsvc.LocalService("object_proxy")
|
||||||
|
@ -463,7 +463,7 @@ class report_spool(netsvc.Service):
|
||||||
if not context:
|
if not context:
|
||||||
context={}
|
context={}
|
||||||
security.check(db, uid, passwd)
|
security.check(db, uid, passwd)
|
||||||
|
|
||||||
self.id_protect.acquire()
|
self.id_protect.acquire()
|
||||||
self.id += 1
|
self.id += 1
|
||||||
id = self.id
|
id = self.id
|
||||||
|
|
|
@ -109,10 +109,10 @@ class fake_cursor:
|
||||||
self.print_log('into')
|
self.print_log('into')
|
||||||
self.obj.close()
|
self.obj.close()
|
||||||
|
|
||||||
# This force the cursor to be freed, and thus, available again. It is
|
# This force the cursor to be freed, and thus, available again. It is
|
||||||
# important because otherwise we can overload the server very easily
|
# important because otherwise we can overload the server very easily
|
||||||
# because of a cursor shortage (because cursors are not garbage
|
# because of a cursor shortage (because cursors are not garbage
|
||||||
# collected as fast as they should). The problem is probably due in
|
# collected as fast as they should). The problem is probably due in
|
||||||
# part because browse records keep a reference to the cursor.
|
# part because browse records keep a reference to the cursor.
|
||||||
del self.obj
|
del self.obj
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class fakedb:
|
||||||
def __init__(self, truedb, dbname):
|
def __init__(self, truedb, dbname):
|
||||||
self.truedb = truedb
|
self.truedb = truedb
|
||||||
self.dbname = dbname
|
self.dbname = dbname
|
||||||
|
|
||||||
def cursor(self):
|
def cursor(self):
|
||||||
return fake_cursor(self.truedb, {}, self.dbname)
|
return fake_cursor(self.truedb, {}, self.dbname)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue