Mercurial > libervia-backend
comparison frontends/src/jp/cmd_pubsub.py @ 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 | ebc0dfe9c0ca |
children | b29a53fb270d |
comparison
equal
deleted
inserted
replaced
2358:71b10dd7a13a | 2359:47516e90d26a |
---|---|
418 try: | 418 try: |
419 from lxml import etree | 419 from lxml import etree |
420 except ImportError: | 420 except ImportError: |
421 self.disp(u"lxml module must be installed to use edit, please install it with \"pip install lxml\"", error=True) | 421 self.disp(u"lxml module must be installed to use edit, please install it with \"pip install lxml\"", error=True) |
422 self.host.quit(1) | 422 self.host.quit(1) |
423 parser = etree.XMLParser(remove_blank_text=True) | |
424 schema_elt = etree.fromstring(schema, parser) | |
425 content_file_obj, content_file_path = self.getTmpFile() | 423 content_file_obj, content_file_path = self.getTmpFile() |
426 content_file_obj.write(etree.tostring(schema_elt, encoding="utf-8", pretty_print=True)) | 424 schema = schema.strip() |
427 content_file_obj.seek(0) | 425 if schema: |
426 parser = etree.XMLParser(remove_blank_text=True) | |
427 schema_elt = etree.fromstring(schema, parser) | |
428 content_file_obj.write(etree.tostring(schema_elt, encoding="utf-8", pretty_print=True)) | |
429 content_file_obj.seek(0) | |
428 self.runEditor("pubsub_schema_editor_args", content_file_path, content_file_obj) | 430 self.runEditor("pubsub_schema_editor_args", content_file_path, content_file_obj) |
429 | 431 |
430 def start(self): | 432 def start(self): |
431 common.checkURI(self.args) | 433 common.checkURI(self.args) |
432 self.host.bridge.psSchemaGet( | 434 self.host.bridge.psSchemaGet( |