Fix sql_error on wizard and report

This commit is contained in:
Cédric Krier committed 2008-09-04 17:22:53 +02:00
1 parent a34240f6ff
commit 0988ecda1d
2 files changed
+8 -6

No files matched your search

+4 -3
View File
@@ -24,7 +24,6 @@ from genshi.filters import Translator
import traceback
from trytond.config import CONFIG
from trytond.sql_db import IntegrityError
from trytond.tools import find_language_context
MODULE_LIST = []
MODULE_CLASS_LIST = {}
@@ -59,15 +58,17 @@ class ReportService(Service):
pool = pooler.get_pool(cursor.dbname)
for key in pool._sql_errors.keys():
if key in exception[0]:
msg = self._sql_errors[key]
msg = pool._sql_errors[key]
cursor2 = pooler.get_db(cursor.dbname).cursor()
if context is None:
context = {}
try:
cursor2.execute('SELECT value ' \
'FROM ir_translation ' \
'WHERE lang=%s ' \
'AND type=%s ' \
'AND src=%s',
(find_language_context(args), 'error',
(context.get('language', 'en_US'), 'error',
msg))
if cursor2.rowcount:
res = cursor2.fetchone()[0]
+4 -3
View File
@@ -9,7 +9,6 @@ from trytond.config import CONFIG
import sys
from trytond.sql_db import IntegrityError
import traceback
from trytond.tools import find_language_context
MODULE_LIST = []
MODULE_CLASS_LIST = {}
@@ -44,15 +43,17 @@ class WizardService(Service):
pool = pooler.get_pool(cursor.dbname)
for key in pool._sql_errors.keys():
if key in exception[0]:
msg = self._sql_errors[key]
msg = pool._sql_errors[key]
cursor2 = pooler.get_db(cursor.dbname).cursor()
if context is None:
context = {}
try:
cursor2.execute('SELECT value ' \
'FROM ir_translation ' \
'WHERE lang=%s ' \
'AND type=%s ' \
'AND src=%s',
(find_language_context(args), 'error',
(context.get('language', 'en_US'), 'error',
msg))
if cursor2.rowcount:
res = cursor2.fetchone()[0]