]> git.phdru.name Git - m_lib.git/blob - m_lib/net/www/serverpush.py
Remove wrong copyright lines, fix module docstrings
[m_lib.git] / m_lib / net / www / serverpush.py
1 """Server Push"""
2
3
4 import sys, mimetools
5
6 class ServerPush:
7    def __init__(self, out=sys.stdout):
8       self.out = out
9       self.output = out.write
10       self.boundary = mimetools.choose_boundary()
11
12
13    def start(self):
14       self.output("""\
15 Content-type: multipart/x-mixed-replace;boundary=%s
16
17 """ % self.boundary)
18
19
20    def next(self, content_type="text/html"):
21       self.output("""\
22 --%s
23 Content-type: %s
24 """ % (self.boundary, content_type))
25
26
27    def stop(self):
28       self.output("--%s--" % self.boundary)