from tornado import httpclient
from tornado import escape
from tornado.ioloop import IOLoop
+from tornado.util import bytes_type
class OpenIdMixin(object):
"""Abstract implementation of OpenID and Attribute Exchange.
args["cancel_url"] = urlparse.urljoin(
self.request.full_url(), cancel_uri)
if extended_permissions:
- if isinstance(extended_permissions, basestring):
+ if isinstance(extended_permissions, (unicode, bytes_type)):
extended_permissions = [extended_permissions]
args["req_perms"] = ",".join(extended_permissions)
self.redirect("http://www.facebook.com/login.php?" +
from tornado.escape import utf8
from tornado import httputil
from tornado.ioloop import IOLoop
-from tornado.util import import_object
+from tornado.util import import_object, bytes_type
class HTTPClient(object):
"""A blocking HTTP client.
on each IOLoop. Additional arguments may be supported depending
on the implementation class in use.
"""
- if isinstance(impl, basestring):
+ if isinstance(impl, (unicode, bytes_type)):
impl = import_object(impl)
if impl is not None and not issubclass(impl, AsyncHTTPClient):
raise ValueError("Invalid AsyncHTTPClient implementation")
from tornado import httpserver
from tornado import ioloop
from tornado import web
+from tornado.util import bytes_type
def start(port, root_directory="/tmp/s3", bucket_depth=0):
"""Starts the mock S3 server on the given port at the given path."""
''.join(parts))
def _render_parts(self, value, parts=[]):
- if isinstance(value, basestring):
+ if isinstance(value, (unicode, bytes_type)):
parts.append(escape.xhtml_escape(value))
elif isinstance(value, int) or isinstance(value, long):
parts.append(str(value))
HTTP specification. If the value is not a string, we convert it to
a string. All header values are then encoded as UTF-8.
"""
- if isinstance(value, basestring):
+ if isinstance(value, (unicode, bytes_type)):
value = utf8(value)
# If \n is allowed into the header, it is possible to inject
# additional headers or split the request. Also cap length to
if embed_part: js_embed.append(utf8(embed_part))
file_part = module.javascript_files()
if file_part:
- if isinstance(file_part, basestring):
+ if isinstance(file_part, (unicode, bytes_type)):
js_files.append(file_part)
else:
js_files.extend(file_part)
if embed_part: css_embed.append(utf8(embed_part))
file_part = module.css_files()
if file_part:
- if isinstance(file_part, basestring):
+ if isinstance(file_part, (unicode, bytes_type)):
css_files.append(file_part)
else:
css_files.extend(file_part)