Mercurial > libervia-backend
changeset 2359:47516e90d26a
jp (pubsub/node/schema): check that a schema exists before parsing it (fix issue on new schema edition)
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 24 Sep 2017 16:29:18 +0200 |
parents | 71b10dd7a13a |
children | 72cbb6478f97 |
files | frontends/src/jp/cmd_pubsub.py |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/src/jp/cmd_pubsub.py Fri Sep 22 18:04:14 2017 +0200 +++ b/frontends/src/jp/cmd_pubsub.py Sun Sep 24 16:29:18 2017 +0200 @@ -420,11 +420,13 @@ except ImportError: self.disp(u"lxml module must be installed to use edit, please install it with \"pip install lxml\"", error=True) self.host.quit(1) - parser = etree.XMLParser(remove_blank_text=True) - schema_elt = etree.fromstring(schema, parser) content_file_obj, content_file_path = self.getTmpFile() - content_file_obj.write(etree.tostring(schema_elt, encoding="utf-8", pretty_print=True)) - content_file_obj.seek(0) + schema = schema.strip() + if schema: + parser = etree.XMLParser(remove_blank_text=True) + schema_elt = etree.fromstring(schema, parser) + content_file_obj.write(etree.tostring(schema_elt, encoding="utf-8", pretty_print=True)) + content_file_obj.seek(0) self.runEditor("pubsub_schema_editor_args", content_file_path, content_file_obj) def start(self):