jp (pubsub/node/schema): check that a schema exists before parsing it (fix issue on new schema edition)
This commit is contained in:
parent
3d6cac0403
commit
c7ccdde0c9
1 changed files with 6 additions and 4 deletions
|
|
@ -420,11 +420,13 @@ class NodeSchemaEdit(base.CommandBase, common.BaseEdit):
|
|||
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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue