mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 10:46:24 +00:00
Accept unicode return values and encode them to UTF-8
Nevow accepts unicode in most places it accepts bytes and does the usual sloppy Python 2 thing, lets one or the other get implicitly re-coded, typically using the ascii codec. We'll go with UTF-8 because that fails less often than ASCII. We may want to clean up the code at some point so we're not accidentally slinging both bytes and text around as if they were the same thing.
This commit is contained in:
parent
9e26599a76
commit
84acf4e50f
@ -571,6 +571,12 @@ def _finish(result, render, request):
|
||||
resource=fullyQualifiedName(type(result)),
|
||||
)
|
||||
result.render(request)
|
||||
elif isinstance(result, unicode):
|
||||
Message.log(
|
||||
message_type=u"allmydata:web:common-render:unicode",
|
||||
)
|
||||
request.write(result.encode("utf-8"))
|
||||
request.finish()
|
||||
elif isinstance(result, bytes):
|
||||
Message.log(
|
||||
message_type=u"allmydata:web:common-render:bytes",
|
||||
|
Loading…
Reference in New Issue
Block a user