diff options
| author | Xavier Morel <xmo@odoo.com> | 2017-05-10 16:34:36 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2017-05-12 16:15:40 +0200 |
| commit | 07ab8b6cd2b44aeb91dadc35adf5f4b19f1399b2 (patch) | |
| tree | e11bc7b07e68ff4ee0a07c1a786abd2f3abe27a8 /addons | |
| parent | 3dd3790597e84186d922b798aa8bb4650513ce4b (diff) | |
[FIX] P3: Exception.message removed
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/auth_signup/controllers/main.py | 4 | ||||
| -rw-r--r-- | addons/base_import/models/base_import.py | 4 | ||||
| -rw-r--r-- | addons/gamification/models/goal.py | 6 | ||||
| -rw-r--r-- | addons/hw_escpos/controllers/main.py | 2 | ||||
| -rw-r--r-- | addons/mail/models/mail_mail.py | 2 | ||||
| -rw-r--r-- | addons/payment_ogone/controllers/main.py | 2 | ||||
| -rw-r--r-- | addons/web/controllers/main.py | 4 | ||||
| -rw-r--r-- | addons/website_slides/controllers/main.py | 2 |
8 files changed, 14 insertions, 12 deletions
diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py index db636797d12..825a880b62c 100644 --- a/addons/auth_signup/controllers/main.py +++ b/addons/auth_signup/controllers/main.py @@ -38,7 +38,7 @@ class AuthSignupHome(Home): if request.env["res.users"].sudo().search([("login", "=", qcontext.get("login"))]): qcontext["error"] = _("Another user is already registered using this email address.") else: - _logger.error(e.message) + _logger.error("%s", e) qcontext['error'] = _("Could not create a new account.") return request.render('auth_signup.signup', qcontext) @@ -64,7 +64,7 @@ class AuthSignupHome(Home): qcontext['error'] = _("Could not reset your password") _logger.exception('error when resetting password') except Exception as e: - qcontext['error'] = e.message or e.name + qcontext['error'] = str(e) response = request.render('auth_signup.reset_password', qcontext) response.headers['X-Frame-Options'] = 'DENY' diff --git a/addons/base_import/models/base_import.py b/addons/base_import/models/base_import.py index 0b6b534a28a..35262774bf4 100644 --- a/addons/base_import/models/base_import.py +++ b/addons/base_import/models/base_import.py @@ -617,9 +617,9 @@ class Import(models.TransientModel): try: line[index] = dt.strftime(dt.strptime(ustr(line[index]).encode('utf-8'), user_format), server_format) except ValueError as e: - raise ValueError(_("Column %s contains incorrect values. Error in line %d: %s") % (name, num + 1, ustr(e.message))) + raise ValueError(_("Column %s contains incorrect values. Error in line %d: %s") % (name, num + 1, e)) except Exception as e: - raise ValueError(_("Error Parsing Date [%s:L%d]: %s") % (name, num + 1, ustr(e.message))) + raise ValueError(_("Error Parsing Date [%s:L%d]: %s") % (name, num + 1, e)) elif field['type'] in ('float', 'monetary') and name in import_fields: # Parse float, sometimes float values from file have currency symbol or () to denote a negative value diff --git a/addons/gamification/models/goal.py b/addons/gamification/models/goal.py index 89f037d55d3..56c447dd9d4 100644 --- a/addons/gamification/models/goal.py +++ b/addons/gamification/models/goal.py @@ -87,7 +87,9 @@ class GoalDefinition(models.Model): # dummy search to make sure the domain is valid Obj.search_count(domain) except (ValueError, SyntaxError) as e: - msg = e.message or (e.msg + '\n' + e.text) + msg = e + if isinstance(e, SyntaxError): + msg = (e.msg + '\n' + e.text) raise exceptions.UserError(_("The domain for the definition %s seems incorrect, please check it.\n\n%s") % (definition.name, msg)) return True @@ -105,7 +107,7 @@ class GoalDefinition(models.Model): _("The model configuration for the definition %s seems incorrect, please check it.\n\n%s not stored") % (definition.name, definition.field_id.name)) except KeyError as e: raise exceptions.UserError( - _("The model configuration for the definition %s seems incorrect, please check it.\n\n%s not found") % (definition.name, e.message)) + _("The model configuration for the definition %s seems incorrect, please check it.\n\n%s not found") % (definition.name, e)) @api.model def create(self, vals): diff --git a/addons/hw_escpos/controllers/main.py b/addons/hw_escpos/controllers/main.py index e55dc57af5a..6c929ca2f26 100644 --- a/addons/hw_escpos/controllers/main.py +++ b/addons/hw_escpos/controllers/main.py @@ -81,7 +81,7 @@ class EscposDriver(Thread): try: description = usb.util.get_string(printer, 256, printer.iManufacturer) + " " + usb.util.get_string(printer, 256, printer.iProduct) except Exception as e: - _logger.error("Can not get printer description: %s" % (e.message or repr(e))) + _logger.error("Can not get printer description: %s" % e) description = 'Unknown printer' connected.append({ 'vendor': printer.idVendor, diff --git a/addons/mail/models/mail_mail.py b/addons/mail/models/mail_mail.py index 8517274205b..3f206424e07 100644 --- a/addons/mail/models/mail_mail.py +++ b/addons/mail/models/mail_mail.py @@ -326,7 +326,7 @@ class MailMail(models.Model): res = IrMailServer.send_email( msg, mail_server_id=mail.mail_server_id.id, smtp_session=smtp_session) except AssertionError as error: - if error.message == IrMailServer.NO_VALID_RECIPIENT: + if str(error) == IrMailServer.NO_VALID_RECIPIENT: # No valid recipient found for this particular # mail item -> ignore error to avoid blocking # delivery to next recipients, if any. If this is diff --git a/addons/payment_ogone/controllers/main.py b/addons/payment_ogone/controllers/main.py index 2dfa2747ab8..53150686f25 100644 --- a/addons/payment_ogone/controllers/main.py +++ b/addons/payment_ogone/controllers/main.py @@ -41,7 +41,7 @@ class OgoneController(http.Controller): acq.s2s_process(post) except Exception as e: # synthax error: 'CHECK ERROR: |Not a valid date\n\n50001111: None' - error = e.message.splitlines()[0].split('|')[-1] or '' + error = str(e).splitlines()[0].split('|')[-1] or '' return werkzeug.utils.redirect(post.get('return_url', '/') + (error and '#error=%s' % werkzeug.url_quote(error) or '')) @http.route(['/payment/ogone/s2s/feedback'], auth='none', csrf=False) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index f00c6ff5122..105c8ab7841 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1053,7 +1053,7 @@ class Binary(http.Controller): args = [len(data), ufile.filename, ufile.content_type, base64.b64encode(data)] except Exception as e: - args = [False, e.message] + args = [False, str(e)] return out % (json.dumps(callback), json.dumps(args)) @http.route('/web/binary/upload_attachment', type='http', auth="user") @@ -1647,4 +1647,4 @@ class ReportController(http.Controller): @http.route(['/report/check_wkhtmltopdf'], type='json', auth="user") def check_wkhtmltopdf(self): - return request.env['ir.actions.report'].get_wkhtmltopdf_state()
\ No newline at end of file + return request.env['ir.actions.report'].get_wkhtmltopdf_state() diff --git a/addons/website_slides/controllers/main.py b/addons/website_slides/controllers/main.py index 6385c84069a..adc6aeaad39 100644 --- a/addons/website_slides/controllers/main.py +++ b/addons/website_slides/controllers/main.py @@ -319,7 +319,7 @@ class WebsiteSlides(http.Controller): return {'error': e.name} except Exception as e: _logger.error(e) - return {'error': _('Internal server error, please try again later or contact administrator.\nHere is the error message: %s') % e.message} + return {'error': _('Internal server error, please try again later or contact administrator.\nHere is the error message: %s') % e} return {'url': "/slides/slide/%s" % (slide_id.id)} # -------------------------------------------------- |
