[IMP] openerp.modules.db: nice critical logging, and nice IOError exception
when the base.sql is not found. bzr revid: vmt@openerp.com-20110916121315-lklf5nib8u1pztk5
This commit is contained in:
parent
3db8df9e85
commit
20d7d05a60
|
@ -21,6 +21,7 @@
|
|||
##############################################################################
|
||||
|
||||
import openerp.modules
|
||||
import logging
|
||||
|
||||
def is_initialized(cr):
|
||||
""" Check if a database has been initialized for the ORM.
|
||||
|
@ -40,6 +41,10 @@ def initialize(cr):
|
|||
|
||||
"""
|
||||
f = openerp.modules.get_module_resource('base', 'base.sql')
|
||||
if not f:
|
||||
m = "File not found: 'base.sql' (provided by module 'base')."
|
||||
logging.getLogger('init').critical(m)
|
||||
raise IOError(m)
|
||||
base_sql_file = openerp.tools.misc.file_open(f)
|
||||
try:
|
||||
cr.execute(base_sql_file.read())
|
||||
|
|
Loading…
Reference in New Issue