return env
def recode(thing):
- if isinstance(thing, collections.abc.ByteString):
+ if isinstance(thing, collections.abc.Buffer):
return thing
else:
return str(thing).encode("utf-8")
try:
if len(self.resp) > 0:
status = self.resp[0]
- if isinstance(status, collections.abc.ByteString):
+ if isinstance(status, collections.abc.Buffer):
status = status.decode("latin-1")
else:
status = str(status)
handlers, wrapping the low-level ashd.proto module.
"""
-import os, socket, collections
+import os, socket, collections.abc
from . import proto
__all__ = ["stdfork", "pchild", "respond", "serveloop"]
For example:
respond(req, "Not found", status = "404 Not Found", ctype = "text/plain")
"""
- if isinstance(body, collections.ByteString):
+ if isinstance(body, collections.abc.Buffer):
body = bytes(body)
else:
body = str(body)
#!/usr/bin/python3
-import sys, os, getopt, logging, collections
+import sys, os, getopt, logging, collections.abc
import socket
import ashd.scgi, ashd.serve
try:
return env
def recode(thing):
- if isinstance(thing, collections.ByteString):
+ if isinstance(thing, collections.abc.Buffer):
return thing
else:
return str(thing).encode("latin-1")