Would be simpler as:
if msg:
details['STDOUT:'] = content.text_content(msg)
(assuming msg is a unicode object, not a bytestring). If msg is a
bytestring, then:
if msg:
details['STDOUT:'] = content.Content(content_type.UTF8_TEXT, lambda:[msg])
would be appropriate.
As it is, you're generating content objects that iterate bytes of
length 1, which will be pathologically slow, so you should change this
one way or another. Happy to chat on IRC or wherever if you need more
pointers.
This:
+ if msg:
+ details['STDOUT:'] = content.Content(
+ self.PLAIN_TEXT, partial(lambda x: x, msg))
Would be simpler as: 'STDOUT: '] = content. text_content( msg)
if msg:
details[
(assuming msg is a unicode object, not a bytestring). If msg is a 'STDOUT: '] = content. Content( content_ type.UTF8_ TEXT, lambda:[msg])
bytestring, then:
if msg:
details[
would be appropriate.
As it is, you're generating content objects that iterate bytes of
length 1, which will be pathologically slow, so you should change this
one way or another. Happy to chat on IRC or wherever if you need more
pointers.
-Rob