Peter,
     Thanks for sorting out Pyjamas logging - a great improvement. One 
point which I suggested during an earlier thread is still outstanding 
however.

Here is the code for ApendHandler.emit

(pyjamas/library/pyjamas/logging/handlers.py, class AppendHandler)
     def emit(self, record):
         msg = self.format(record)
         msg = msg.replace("\n", "<br/>\n") + "<br/>\n"
         self.output += msg
         self.__addLogElement()
         DOM.setInnerHTML(self.div, self.output)

The text in msg is going straight into DOM.setInnerHTML, so it had 
better be legal HTML. You have recognised the need to convert line 
terminators into break tags but I think you should also escape &, < and 
 >. This can be done very simply by adding
      msg = cgi.escape(msg)
immediately before the line
      msg = msg.replace("\n", "<br/>\n") + "<br/>\n"

Of course 'import cgi' would be needed at the head of the module.

Regards,
Phil

Reply via email to