Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/server.py @ 50574:6be6406a2988
safehasattr: pass attribute name as string instead of bytes
This is a step toward replacing `util.safehasattr` usage with plain `hasattr`.
The builtin function behave poorly in Python2 but this was fixed in Python3.
These change are done one by one as they tend to have a small odd to trigger
puzzling breackage.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 02 Feb 2023 17:27:22 +0100 |
parents | a3c856e2ea2f |
children | eb49f8fb11d8 |
comparison
equal
deleted
inserted
replaced
50573:3b642b384b14 | 50574:6be6406a2988 |
---|---|
98 def log_message(self, format, *args): | 98 def log_message(self, format, *args): |
99 self._log_any(self.server.accesslog, format, *args) | 99 self._log_any(self.server.accesslog, format, *args) |
100 | 100 |
101 def log_request(self, code='-', size='-'): | 101 def log_request(self, code='-', size='-'): |
102 xheaders = [] | 102 xheaders = [] |
103 if util.safehasattr(self, b'headers'): | 103 if util.safehasattr(self, 'headers'): |
104 xheaders = [ | 104 xheaders = [ |
105 h for h in self.headers.items() if h[0].startswith('x-') | 105 h for h in self.headers.items() if h[0].startswith('x-') |
106 ] | 106 ] |
107 self.log_message( | 107 self.log_message( |
108 '"%s" %s %s%s', | 108 '"%s" %s %s%s', |