Has anyone thought about capturing stdout so that servlets can use print instead of self.writeln(...)

def awake(self, trans):
  self.oldStdout = sys.stdout
  sys.stdout = trans.response().streamOut()

def writeContent(self):
  a = 'hello'
  b = 'world'
  print '<p>', a, b, '</p>'

def sleep(self, trans):
  sys.stdout = self.oldStdout

Actually stdout should probably be captured when the servlet get invoked so that it can capture any exceptions and make sure that stdout gets restored.



-------------------------------------------------------
This SF.net email is sponsored by: Does your code think in ink? You could win a Tablet PC. Get a free Tablet PC hat just for playing. What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to