details: https://code.tryton.org/tryton/commit/419eb1c2556c
branch: default
user: Cédric Krier <[email protected]>
date: Tue Sep 01 21:57:25 2026 +0200
description:
Use the directory of the stream name as base when parsing XML
diffstat:
trytond/trytond/convert.py | 9 +++++----
trytond/trytond/modules/__init__.py | 3 +--
2 files changed, 6 insertions(+), 6 deletions(-)
diffs (49 lines):
diff -r 404795ef1a6f -r 419eb1c2556c trytond/trytond/convert.py
--- a/trytond/trytond/convert.py Tue Aug 25 12:26:08 2026 +0200
+++ b/trytond/trytond/convert.py Tue Sep 01 21:57:25 2026 +0200
@@ -395,7 +395,7 @@
self.skip_data = False
self.modules = modules
self.languages = languages
- self.base_path = None
+ self.base_path = ''
# Tag handlders are used to delegate the processing
self.taghandlerlist = {
@@ -413,11 +413,12 @@
self.sax_parser.setFeature(sax.handler.feature_namespaces, 0)
self.sax_parser.setContentHandler(self)
- def parse_xmlstream(self, stream, base_path):
+ def parse_xmlstream(self, stream):
"""
Take a byte stream has input and parse the xml content.
"""
- self.base_path = base_path
+ self.base_path = (
+ os.path.dirname(stream.name) if hasattr(stream, 'name') else '')
source = sax.InputSource()
source.setByteStream(stream)
@@ -427,7 +428,7 @@
except Exception as e:
raise ParsingError("in %s" % self.current_state()) from e
- self.base_path = None
+ self.base_path = ''
return self.to_delete
def startElement(self, name, attributes):
diff -r 404795ef1a6f -r 419eb1c2556c trytond/trytond/modules/__init__.py
--- a/trytond/trytond/modules/__init__.py Tue Aug 25 12:26:08 2026 +0200
+++ b/trytond/trytond/modules/__init__.py Tue Sep 01 21:57:25 2026 +0200
@@ -317,8 +317,7 @@
# Feed the parser with xml content:
with tools.file_open(
os.path.join(module, filename), 'rb') as fp:
- tryton_parser.parse_xmlstream(
- fp, base_path=os.path.dirname(filename))
+ tryton_parser.parse_xmlstream(fp)
modules_todo.append((module, list(tryton_parser.to_delete)))