comparison frontends/src/jp/cmd_debug.py @ 2441:e86dc8cb4345

jp (debug/monitor): if data can't be parsed (happen at beginning/end of stream because it's not complete XML), it is printed directly.
author Goffi <goffi@goffi.org>
date Sun, 19 Nov 2017 16:38:35 +0100
parents 192ae573901a
children 0046283a285d
comparison
equal deleted inserted replaced
2440:51d346e283fd 2441:e86dc8cb4345
136 else: 136 else:
137 self.disp(A.color(A.BOLD, A.FG_CYAN, '==== OUT ====>>>', A.FG_WHITE, profile_disp)) 137 self.disp(A.color(A.BOLD, A.FG_CYAN, '==== OUT ====>>>', A.FG_WHITE, profile_disp))
138 if whiteping: 138 if whiteping:
139 self.disp('[WHITESPACE PING]') 139 self.disp('[WHITESPACE PING]')
140 else: 140 else:
141 self.output(xml_data) 141 try:
142 self.output(xml_data)
143 except Exception:
144 # initial stream is not valid XML,
145 # in this case we print directly to data
146 # FIXME: we should test directly lxml.etree.XMLSyntaxError
147 # but importing lxml directly here is not clean
148 # should be wrapped in a custom Exception
149 self.disp(xml_data)
150 self.disp(u'')
142 151
143 def start(self): 152 def start(self):
144 self.host.bridge.register_signal('xmlLog', self.printXML, 'plugin') 153 self.host.bridge.register_signal('xmlLog', self.printXML, 'plugin')
145 154
146 155