ContentWrite callback class is defined for writing streams of data through the session
| 50 | return len(self.content) |
| 51 | |
| 52 | class ContentWrite(object): |
| 53 | """ ContentWrite callback class is defined for writing streams of data through the session |
| 54 | """ |
| 55 | def __init__(self, data): |
| 56 | self.content = data |
| 57 | |
| 58 | def process(self, output_stream): |
| 59 | """ Use codecs getWriter to write data encoded to the stream |
| 60 | """ |
| 61 | codecs.getwriter('utf-8')(output_stream).write(self.content) |
| 62 | return len(self.content) |
| 63 | |
| 64 | def onTrigger(context, session): |
| 65 | """ onTrigger is executed and passed processor context and session |