changeset 8114deea2464 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset;node=8114deea2464
description:
        Use raise from instead of logging

        issue10146
        review357301002
diffstat:

 trytond/convert.py    |  7 ++-----
 trytond/ir/ui/view.py |  8 --------
 2 files changed, 2 insertions(+), 13 deletions(-)

diffs (56 lines):

diff -r 5797b992383d -r 8114deea2464 trytond/convert.py
--- a/trytond/convert.py        Sun Mar 07 19:07:53 2021 +0100
+++ b/trytond/convert.py        Thu Mar 11 19:07:33 2021 +0100
@@ -455,11 +455,8 @@
 
         try:
             self.sax_parser.parse(source)
-        except Exception:
-            logger.error(
-                "Error while parsing xml file:\n" + self.current_state(),
-                exc_info=True)
-            raise
+        except Exception as e:
+            raise Exception("Error " + self.current_state()) from e
         return self.to_delete
 
     def startElement(self, name, attributes):
diff -r 5797b992383d -r 8114deea2464 trytond/ir/ui/view.py
--- a/trytond/ir/ui/view.py     Sun Mar 07 19:07:53 2021 +0100
+++ b/trytond/ir/ui/view.py     Thu Mar 11 19:07:33 2021 +0100
@@ -1,7 +1,6 @@
 # This file is part of Tryton.  The COPYRIGHT file at the top level of
 # this repository contains the full copyright notices and license terms.
 import os
-import logging
 import json
 
 from lxml import etree
@@ -17,8 +16,6 @@
 from trytond.cache import Cache
 from trytond.rpc import RPC
 
-logger = logging.getLogger(__name__)
-
 
 class XMLError(ValidationError):
     pass
@@ -137,8 +134,6 @@
                 if not validator.validate(tree):
                     error_log = '\n'.join(map(str,
                             validator.error_log.filter_from_errors()))
-                    logger.error('Invalid XML view %s:\n%s\n%s',
-                        view.rec_name, error_log, xml)
                     raise XMLError(
                         gettext('ir.msg_view_invalid_xml', name=view.rec_name),
                         error_log)
@@ -160,9 +155,6 @@
                         error_log = '%s: <%s %s="%s"/>' % (
                             e, element.get('id') or element.get('name'), attr,
                             element.get(attr))
-                        logger.error(
-                            'Invalid XML view %s:\n%s\n%s',
-                            view.rec_name, error_log, xml)
                         raise XMLError(
                             gettext(
                                 'ir.msg_view_invalid_xml', name=view.rec_name),

Reply via email to