comparison mercurial/hgweb/wsgiheaders.py @ 41601:765a608c2108

wsgiheaders: make sure __repr__() returns a string When printing `req.headers` on the server side to debug, it complained that '%b' needed to take a string, not bytes. Changing '%s' to '%r' caused it to complain that __repr__ didn't return a string.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 05 Feb 2019 16:16:14 -0500
parents 74e1362585c0
children 2372284d9457
comparison
equal deleted inserted replaced
41600:ccaa52865fac 41601:765a608c2108
125 list. 125 list.
126 """ 126 """
127 return self._headers[:] 127 return self._headers[:]
128 128
129 def __repr__(self): 129 def __repr__(self):
130 return "%s(%r)" % (self.__class__.__name__, self._headers) 130 return r"%s(%r)" % (self.__class__.__name__, self._headers)
131 131
132 def __str__(self): 132 def __str__(self):
133 """str() returns the formatted headers, complete with end line, 133 """str() returns the formatted headers, complete with end line,
134 suitable for direct HTTP transmission.""" 134 suitable for direct HTTP transmission."""
135 return '\r\n'.join(["%s: %s" % kv for kv in self._headers]+['','']) 135 return '\r\n'.join(["%s: %s" % kv for kv in self._headers]+['',''])