[FIX] DB creation failure : Better message attached to the exception

lp bug: https://launchpad.net/bugs/885664 fixed

bzr revid: support@serpentcs.com-20111116201946-n3lkqtjgb0x3psa8
This commit is contained in:
Serpent Consulting Services 2011-11-17 01:49:46 +05:30
commit 09dd34bd06
1 changed files with 9 additions and 4 deletions

View File

@ -268,13 +268,18 @@ class Database(openerpweb.Controller):
params['db_lang'],
params['create_admin_pwd']
)
error_message = ''
try:
return req.session.proxy("db").create(*create_attrs)
except xmlrpclib.Fault, e:
if e.faultCode and e.faultCode.split(':')[0] == 'AccessDenied':
return {'error': e.faultCode, 'title': 'Create Database'}
return {'error': 'Could not create database !', 'title': 'Create Database'}
if e.faultCode:
error_message = e.faultCode
if e.faultCode.split(':')[0] == 'AccessDenied':
return {'error': error_message, 'title': 'Create Database'}
if not error_message:
error_message = 'System has encountered problems while creating the Database "' + params['db_name'] + '"'
return {'error': error_message , 'title': 'Could not create database!'}
@openerpweb.jsonrequest
def drop(self, req, fields):