[IMP] logging for set null failed

bzr revid: fp@tinyerp.com-20110115170410-s0z661hshxjzj6b7
This commit is contained in:
Fabien Pinckaers 2011-01-15 18:04:10 +01:00
parent f01e3326ba
commit 322976309e
3 changed files with 6 additions and 6 deletions

View File

@ -423,7 +423,7 @@ class orm_template(object):
model_id = cr.fetchone()[0]
if 'module' in context:
name_id = 'model_'+self._name.replace('.', '_')
cr.execute('select * from ir_model_data where name=%s and res_id=%s and module=%s', (name_id, model_id, context['module']))
cr.execute('select * from ir_model_data where name=%s and module=%s', (name_id, context['module']))
if not cr.rowcount:
cr.execute("INSERT INTO ir_model_data (name,date_init,date_update,module,model,res_id) VALUES (%s, now(), now(), %s, %s, %s)", \
(name_id, context['module'], 'ir.model', model_id)
@ -2561,7 +2561,7 @@ class orm(orm_template):
# add the NOT NULL constraint
cr.commit()
try:
cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" SET NOT NULL' % (self._table, k))
cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" SET NOT NULL' % (self._table, k), log_exceptions=False)
cr.commit()
self.__schema.debug("Table '%s': column '%s': added NOT NULL constraint",
self._table, k)
@ -2667,7 +2667,7 @@ class orm(orm_template):
if f.required:
try:
cr.commit()
cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" SET NOT NULL' % (self._table, k))
cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" SET NOT NULL' % (self._table, k), log_exceptions=False)
self.__schema.debug("Table '%s': column '%s': added a NOT NULL constraint",
self._table, k)
except Exception:

View File

@ -223,7 +223,7 @@ class db(netsvc.ExportService):
self._create_empty_database(db_name)
cmd = ['pg_restore', '--no-owner', '-w']
cmd = ['pg_restore', '--no-owner']
if tools.config['db_user']:
cmd.append('--username=' + tools.config['db_user'])
if tools.config['db_host']:

View File

@ -128,11 +128,11 @@ class Cursor(object):
params = params or None
res = self._obj.execute(query, params)
except psycopg2.ProgrammingError, pe:
if log_exceptions or self.sql_log:
if log_exceptions:
self.__logger.error("Programming error: %s, in query %s", pe, query)
raise
except Exception:
if log_exceptions or self.sql_log:
if log_exceptions:
self.__logger.exception("bad query: %s", self._obj.query or query)
raise