Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/protocol.py @ 28861:86db5cb55d46
pycompat: switch to util.stringio for py3 compat
author | timeless <timeless@mozdev.org> |
---|---|
date | Sun, 10 Apr 2016 20:55:37 +0000 |
parents | fd2acc5046f6 |
children | 032c4c2f802a |
comparison
equal
deleted
inserted
replaced
28860:50d11dd8ac02 | 28861:86db5cb55d46 |
---|---|
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 from __future__ import absolute_import | 8 from __future__ import absolute_import |
9 | 9 |
10 import cStringIO | |
11 import cgi | 10 import cgi |
12 import urllib | 11 import urllib |
13 import zlib | 12 import zlib |
14 | 13 |
15 from .common import ( | 14 from .common import ( |
18 | 17 |
19 from .. import ( | 18 from .. import ( |
20 util, | 19 util, |
21 wireproto, | 20 wireproto, |
22 ) | 21 ) |
22 stringio = util.stringio | |
23 | 23 |
24 HGTYPE = 'application/mercurial-0.1' | 24 HGTYPE = 'application/mercurial-0.1' |
25 HGERRTYPE = 'application/hg-error' | 25 HGERRTYPE = 'application/hg-error' |
26 | 26 |
27 class webproto(wireproto.abstractserverproto): | 27 class webproto(wireproto.abstractserverproto): |
64 length = int(self.req.env['CONTENT_LENGTH']) | 64 length = int(self.req.env['CONTENT_LENGTH']) |
65 for s in util.filechunkiter(self.req, limit=length): | 65 for s in util.filechunkiter(self.req, limit=length): |
66 fp.write(s) | 66 fp.write(s) |
67 def redirect(self): | 67 def redirect(self): |
68 self.oldio = self.ui.fout, self.ui.ferr | 68 self.oldio = self.ui.fout, self.ui.ferr |
69 self.ui.ferr = self.ui.fout = cStringIO.StringIO() | 69 self.ui.ferr = self.ui.fout = stringio() |
70 def restore(self): | 70 def restore(self): |
71 val = self.ui.fout.getvalue() | 71 val = self.ui.fout.getvalue() |
72 self.ui.ferr, self.ui.fout = self.oldio | 72 self.ui.ferr, self.ui.fout = self.oldio |
73 return val | 73 return val |
74 def groupchunks(self, cg): | 74 def groupchunks(self, cg): |