Initial import to Tizen
[profile/ivi/python-twisted.git] / doc / web / howto / listings / client / stringprod.py
1 from zope.interface import implements
2
3 from twisted.internet.defer import succeed
4 from twisted.web.iweb import IBodyProducer
5
6 class StringProducer(object):
7     implements(IBodyProducer)
8
9     def __init__(self, body):
10         self.body = body
11         self.length = len(body)
12
13     def startProducing(self, consumer):
14         consumer.write(self.body)
15         return succeed(None)
16
17     def pauseProducing(self):
18         pass
19
20     def stopProducing(self):
21         pass