From 9e72676066e05fe2cfe4b12a3d52a2f16401b361 Mon Sep 17 00:00:00 2001 From: Christophe Chauvet Date: Fri, 19 Dec 2008 01:18:23 +0100 Subject: [PATCH] [IMP] * patch to authorized the database name started with a number * patch drop function to work with this improvement bzr revid: christophe.chauvet@syleam.fr-20081219001823-0ikl2j5ztcxlbhdy --- bin/service/web_services.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/service/web_services.py b/bin/service/web_services.py index f1946a01e88..08cf055dd11 100644 --- a/bin/service/web_services.py +++ b/bin/service/web_services.py @@ -70,7 +70,7 @@ class db(netsvc.Service): cr = db.cursor() cr.autocommit(True) time.sleep(0.2) - cr.execute('CREATE DATABASE ' + db_name + ' ENCODING \'unicode\'') + cr.execute('CREATE DATABASE "%s" ENCODING \'unicode\'' % db_name) cr.close() class DBInitialize(object): def __call__(self, serv, id, db_name, demo, lang, user_password='admin'): @@ -149,7 +149,7 @@ class db(netsvc.Service): cr.autocommit(True) try: try: - cr.execute('DROP DATABASE ' + db_name) + cr.execute('DROP DATABASE "%s"' % db_name) except Exception, e: logger.notifyChannel("web-services", netsvc.LOG_ERROR, 'DROP DB: %s failed:\n%s' % (db_name, e)) @@ -198,7 +198,7 @@ class db(netsvc.Service): db = sql_db.db_connect('template1', serialize=1) cr = db.cursor() cr.autocommit(True) - cr.execute('CREATE DATABASE ' + db_name + ' ENCODING \'unicode\'') + cr.execute('CREATE DATABASE "%s" ENCODING \'unicode\'' % db_name) cr.close() cmd = ['pg_restore']