Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/common.py @ 34022:d5b2beca16c0
python3: wrap all uses of <exception>.strerror with strtolocal
Our string literals are bytes, and we mostly want to %-format a
strerror into a one of those literals, so this fixes a ton of issues.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Tue, 22 Aug 2017 20:03:07 -0400 |
parents | 62f9679df1f2 |
children | 67873ec0f4ce |
comparison
equal
deleted
inserted
replaced
34021:31a2eb0f74e5 | 34022:d5b2beca16c0 |
---|---|
176 raise ErrorResponse(HTTP_SERVER_ERROR, 'illegal filename') | 176 raise ErrorResponse(HTTP_SERVER_ERROR, 'illegal filename') |
177 except OSError as err: | 177 except OSError as err: |
178 if err.errno == errno.ENOENT: | 178 if err.errno == errno.ENOENT: |
179 raise ErrorResponse(HTTP_NOT_FOUND) | 179 raise ErrorResponse(HTTP_NOT_FOUND) |
180 else: | 180 else: |
181 raise ErrorResponse(HTTP_SERVER_ERROR, err.strerror) | 181 raise ErrorResponse(HTTP_SERVER_ERROR, |
182 encoding.strtolocal(err.strerror)) | |
182 | 183 |
183 def paritygen(stripecount, offset=0): | 184 def paritygen(stripecount, offset=0): |
184 """count parity of horizontal stripes for easier reading""" | 185 """count parity of horizontal stripes for easier reading""" |
185 if stripecount and offset: | 186 if stripecount and offset: |
186 # account for offset, e.g. due to building the list in reverse | 187 # account for offset, e.g. due to building the list in reverse |