mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 22:14:55 -04:00
Python 3: Convert some unicode/bytes uses (#3569)
This commit is contained in:
parent
c4842e16cb
commit
da7785147d
17 changed files with 122 additions and 67 deletions
|
@ -193,7 +193,7 @@ class MockHttpResource(HttpServer):
|
|||
self.prefix = prefix
|
||||
|
||||
def trigger_get(self, path):
|
||||
return self.trigger("GET", path, None)
|
||||
return self.trigger(b"GET", path, None)
|
||||
|
||||
@patch('twisted.web.http.Request')
|
||||
@defer.inlineCallbacks
|
||||
|
@ -227,7 +227,7 @@ class MockHttpResource(HttpServer):
|
|||
|
||||
headers = {}
|
||||
if federation_auth:
|
||||
headers[b"Authorization"] = ["X-Matrix origin=test,key=,sig="]
|
||||
headers[b"Authorization"] = [b"X-Matrix origin=test,key=,sig="]
|
||||
mock_request.requestHeaders.getRawHeaders = mock_getRawHeaders(headers)
|
||||
|
||||
# return the right path if the event requires it
|
||||
|
@ -241,6 +241,9 @@ class MockHttpResource(HttpServer):
|
|||
except Exception:
|
||||
pass
|
||||
|
||||
if isinstance(path, bytes):
|
||||
path = path.decode('utf8')
|
||||
|
||||
for (method, pattern, func) in self.callbacks:
|
||||
if http_method != method:
|
||||
continue
|
||||
|
@ -249,7 +252,7 @@ class MockHttpResource(HttpServer):
|
|||
if matcher:
|
||||
try:
|
||||
args = [
|
||||
urlparse.unquote(u).decode("UTF-8")
|
||||
urlparse.unquote(u)
|
||||
for u in matcher.groups()
|
||||
]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue