comparison mercurial/hgweb/protocol.py @ 28883:032c4c2f802a

pycompat: switch to util.urlreq/util.urlerr for py3 compat
author timeless <timeless@mozdev.org>
date Wed, 06 Apr 2016 23:22:12 +0000
parents 86db5cb55d46
children 5e2365698d44
comparison
equal deleted inserted replaced
28882:800ec7c048b0 28883:032c4c2f802a
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 cgi 10 import cgi
11 import urllib
12 import zlib 11 import zlib
13 12
14 from .common import ( 13 from .common import (
15 HTTP_OK, 14 HTTP_OK,
16 ) 15 )
18 from .. import ( 17 from .. import (
19 util, 18 util,
20 wireproto, 19 wireproto,
21 ) 20 )
22 stringio = util.stringio 21 stringio = util.stringio
22
23 urlerr = util.urlerr
24 urlreq = util.urlreq
23 25
24 HGTYPE = 'application/mercurial-0.1' 26 HGTYPE = 'application/mercurial-0.1'
25 HGERRTYPE = 'application/hg-error' 27 HGERRTYPE = 'application/hg-error'
26 28
27 class webproto(wireproto.abstractserverproto): 29 class webproto(wireproto.abstractserverproto):
80 yield z.compress(chunk) 82 yield z.compress(chunk)
81 yield z.flush() 83 yield z.flush()
82 def _client(self): 84 def _client(self):
83 return 'remote:%s:%s:%s' % ( 85 return 'remote:%s:%s:%s' % (
84 self.req.env.get('wsgi.url_scheme') or 'http', 86 self.req.env.get('wsgi.url_scheme') or 'http',
85 urllib.quote(self.req.env.get('REMOTE_HOST', '')), 87 urlreq.quote(self.req.env.get('REMOTE_HOST', '')),
86 urllib.quote(self.req.env.get('REMOTE_USER', ''))) 88 urlreq.quote(self.req.env.get('REMOTE_USER', '')))
87 89
88 def iscmd(cmd): 90 def iscmd(cmd):
89 return cmd in wireproto.commands 91 return cmd in wireproto.commands
90 92
91 def call(repo, req, cmd): 93 def call(repo, req, cmd):