Accepted Uppercase DB names and displayed on terminal

bzr revid: jvo@tinyerp.com-20080911072945-jwo9wscd8ko66av9
This commit is contained in:
Jay Vora 2008-09-11 12:59:45 +05:30
parent 619e95b4aa
commit e26e2062b5
3 changed files with 13 additions and 13 deletions

View File

@ -44,7 +44,7 @@ def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False)
db = db_dic[db_name]
else:
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_dic[db_name] = db

View File

@ -87,9 +87,9 @@ class db(netsvc.Service):
cr = None
pool = pooler.get_pool(db_name, demo, serv.actions[id],
update_module=True)
cr = sql_db.db_connect(db_name).cursor()
if lang:
modobj = pool.get('ir.module.module')
mids = modobj.search(cr, 1, [('state', '=', 'installed')])
@ -119,7 +119,7 @@ class db(netsvc.Service):
cr.close()
logger = netsvc.Logger()
logger.notifyChannel("web-services", netsvc.LOG_INFO,
'CREATE DB: %s' % (db_name))
'CREATE DB: %s' % (db_name.lower()))
dbi = DBInitialize()
create_thread = threading.Thread(target=dbi,
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.save()
return True
def list_lang(self):
return tools.scan_languages()
@ -334,7 +334,7 @@ class common(netsvc.Service):
res = security.login(db, login, password)
logger = netsvc.Logger()
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
def about(self, extended=False):
@ -368,13 +368,13 @@ class objects_proxy(netsvc.Service):
self.exportMethod(self.execute)
self.exportMethod(self.exec_workflow)
self.exportMethod(self.obj_list)
def exec_workflow(self, db, uid, passwd, object, method, id):
security.check(db, uid, passwd)
service = netsvc.LocalService("object_proxy")
res = service.exec_workflow(db, uid, object, method, id)
return res
def execute(self, db, uid, passwd, object, method, *args):
security.check(db, uid, passwd)
service = netsvc.LocalService("object_proxy")
@ -463,7 +463,7 @@ class report_spool(netsvc.Service):
if not context:
context={}
security.check(db, uid, passwd)
self.id_protect.acquire()
self.id += 1
id = self.id

View File

@ -109,10 +109,10 @@ class fake_cursor:
self.print_log('into')
self.obj.close()
# This force the cursor to be freed, and thus, available again. It is
# important because otherwise we can overload the server very easily
# This force the cursor to be freed, and thus, available again. It is
# important because otherwise we can overload the server very easily
# 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.
del self.obj
@ -123,7 +123,7 @@ class fakedb:
def __init__(self, truedb, dbname):
self.truedb = truedb
self.dbname = dbname
def cursor(self):
return fake_cursor(self.truedb, {}, self.dbname)