[MERGE] use the postgres db instead of template1 for the creation of a database

bzr revid: stw@openerp.com-20120912111910-b092erlzv2g7wh1u
This commit is contained in:
Stephane Wirtel
2012-09-12 13:19:10 +02:00
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -118,7 +118,7 @@ class db(netsvc.ExportService):
return fn(*params)
def _create_empty_database(self, name):
db = sql_db.db_connect('template1')
db = sql_db.db_connect('postgres')
cr = db.cursor()
chosen_template = tools.config['db_template']
try:
@@ -179,7 +179,7 @@ class db(netsvc.ExportService):
openerp.modules.registry.RegistryManager.delete(db_name)
sql_db.close_db(db_name)
db = sql_db.db_connect('template1')
db = sql_db.db_connect('postgres')
cr = db.cursor()
cr.autocommit(True) # avoid transaction block
try:
@@ -292,7 +292,7 @@ class db(netsvc.ExportService):
openerp.modules.registry.RegistryManager.delete(old_name)
sql_db.close_db(old_name)
db = sql_db.db_connect('template1')
db = sql_db.db_connect('postgres')
cr = db.cursor()
cr.autocommit(True) # avoid transaction block
try:
@@ -320,7 +320,7 @@ class db(netsvc.ExportService):
raise openerp.exceptions.AccessDenied()
chosen_template = tools.config['db_template']
templates_list = tuple(set(['template0', 'template1', 'postgres', chosen_template]))
db = sql_db.db_connect('template1')
db = sql_db.db_connect('postgres')
cr = db.cursor()
try:
try:
@@ -557,7 +557,7 @@ GNU Public Licence.
return http_server.list_http_services()
def exp_check_connectivity(self):
return bool(sql_db.db_connect('template1'))
return bool(sql_db.db_connect('postgres'))
def exp_get_os_time(self):
return os.times()
+1 -1
View File
@@ -223,7 +223,7 @@ class configmanager(object):
help="specify the database port", type="int")
group.add_option("--db_maxconn", dest="db_maxconn", type='int', my_default=64,
help="specify the the maximum number of physical connections to posgresql")
group.add_option("--db-template", dest="db_template", my_default="template0",
group.add_option("--db-template", dest="db_template", my_default="template1",
help="specify a custom database template to create a new database")
parser.add_option_group(group)