Permalink
Browse files

Remove the remaining traces of tornado.util.b.

  • Loading branch information...
bdarnell committed Jan 19, 2013
1 parent 16c6893 commit 925302600f9ba74dc7e7df8ee0d29e293cc7bde8
View
@@ -58,7 +58,7 @@ def _on_auth(self, user):
from tornado import escape
from tornado.httputil import url_concat
from tornado.log import gen_log
-from tornado.util import bytes_type, b, u, unicode_type
+from tornado.util import bytes_type, u, unicode_type
try:
import urlparse # py2
View
@@ -35,7 +35,7 @@ class except to start a server at the beginning of the process
from tornado.log import gen_log
from tornado.netutil import TCPServer
from tornado import stack_context
-from tornado.util import b, bytes_type
+from tornado.util import bytes_type
try:
import ssl # Python 2.6+
View
@@ -23,7 +23,7 @@
from tornado.escape import native_str, parse_qs_bytes, utf8
from tornado.log import gen_log
-from tornado.util import b, ObjectDict
+from tornado.util import ObjectDict
try:
from httplib import responses # py2
@@ -57,7 +57,7 @@ class HTTPHeaders(dict):
>>> for (k,v) in sorted(h.get_all()):
... print('%s: %s' % (k,v))
- ...
+ ...
Content-Type: text/html
Set-Cookie: A=B
Set-Cookie: C=D
View
@@ -37,7 +37,7 @@
from tornado import ioloop
from tornado.log import gen_log, app_log
from tornado import stack_context
-from tornado.util import b, bytes_type
+from tornado.util import bytes_type
try:
import ssl # Python 2.6+
@@ -5,7 +5,6 @@
import socket
from tornado.platform import interface
-from tornado.util import b
class Waker(interface.Waker):
@@ -22,7 +22,6 @@
import os
from tornado.platform import interface
-from tornado.util import b
def set_close_exec(fd):
@@ -8,7 +8,7 @@
from tornado.netutil import Resolver
from tornado.log import gen_log
from tornado import stack_context
-from tornado.util import b, GzipDecompressor
+from tornado.util import GzipDecompressor
import base64
import collections
@@ -8,7 +8,7 @@
from tornado.auth import OpenIdMixin, OAuthMixin, OAuth2Mixin, TwitterMixin
from tornado.escape import json_decode
from tornado.testing import AsyncHTTPTestCase
-from tornado.util import b, u
+from tornado.util import u
from tornado.web import RequestHandler, Application, asynchronous
@@ -25,7 +25,6 @@
from tornado.iostream import IOStream
from tornado.netutil import TCPServer
from tornado.testing import AsyncTestCase, LogTrapTestCase, get_unused_port
-from tornado.util import b
class CapServer(TCPServer):
def handle_stream(self, stream, address):
@@ -5,7 +5,7 @@
import tornado.escape
from tornado.escape import utf8, xhtml_escape, xhtml_unescape, url_escape, url_unescape, to_unicode, json_decode, json_encode
-from tornado.util import b, u, unicode_type
+from tornado.util import u, unicode_type
from tornado.test.util import unittest
linkify_tests = [
View
@@ -4,7 +4,6 @@
from tornado.httpclient import AsyncHTTPClient
from tornado.log import app_log
from tornado.testing import AsyncHTTPTestCase, AsyncTestCase, ExpectLog
-from tornado.util import b
from tornado.web import Application, RequestHandler, asynchronous
from tornado import gen
@@ -16,7 +16,7 @@
from tornado.stack_context import ExceptionStackContext, NullContext
from tornado.testing import AsyncHTTPTestCase, bind_unused_port
from tornado.test.util import unittest
-from tornado.util import b, u, bytes_type
+from tornado.util import u, bytes_type
from tornado.web import Application, RequestHandler, url
@@ -134,7 +134,7 @@ def test_chunked_close(self):
sock, port = bind_unused_port()
with closing(sock):
def write_response(stream, request_data):
- stream.write(b("""\
+ stream.write(b"""\
HTTP/1.1 200 OK
Transfer-Encoding: chunked
@@ -144,7 +144,7 @@ def write_response(stream, request_data):
2
0
-""").replace(b"\n", b"\r\n"), callback=stream.close)
+""".replace(b"\n", b"\r\n"), callback=stream.close)
def accept_callback(conn, address):
# fake an HTTP server using chunked encoding where the final chunks
@@ -11,7 +11,7 @@
from tornado.simple_httpclient import SimpleAsyncHTTPClient
from tornado.testing import AsyncHTTPTestCase, AsyncHTTPSTestCase, AsyncTestCase, ExpectLog
from tornado.test.util import unittest
-from tornado.util import b, u, bytes_type
+from tornado.util import u, bytes_type
from tornado.web import Application, RequestHandler, asynchronous
import datetime
import os
@@ -7,7 +7,6 @@
from tornado.log import gen_log
from tornado.testing import ExpectLog
from tornado.test.util import unittest
-from tornado.util import b
import logging
@@ -65,12 +64,12 @@ def test_url_concat_no_params(self):
class MultipartFormDataTest(unittest.TestCase):
def test_file_upload(self):
- data = b("""\
+ data = b"""\
--1234
Content-Disposition: form-data; name="files"; filename="ab.txt"
Foo
---1234--""").replace(b"\n", b"\r\n")
+--1234--""".replace(b"\n", b"\r\n")
args = {}
files = {}
parse_multipart_form_data(b"1234", data, args, files)
@@ -80,12 +79,12 @@ def test_file_upload(self):
def test_unquoted_names(self):
# quotes are optional unless special characters are present
- data = b("""\
+ data = b"""\
--1234
Content-Disposition: form-data; name=files; filename=ab.txt
Foo
---1234--""").replace(b"\n", b"\r\n")
+--1234--""".replace(b"\n", b"\r\n")
args = {}
files = {}
parse_multipart_form_data(b"1234", data, args, files)
@@ -119,12 +118,12 @@ def test_special_filenames(self):
self.assertEqual(file["body"], b"Foo")
def test_boundary_starts_and_ends_with_quotes(self):
- data = b('''\
+ data = b'''\
--1234
Content-Disposition: form-data; name="files"; filename="ab.txt"
Foo
---1234--''').replace(b"\n", b"\r\n")
+--1234--'''.replace(b"\n", b"\r\n")
args = {}
files = {}
parse_multipart_form_data(b'"1234"', data, args, files)
@@ -133,49 +132,49 @@ def test_boundary_starts_and_ends_with_quotes(self):
self.assertEqual(file["body"], b"Foo")
def test_missing_headers(self):
- data = b('''\
+ data = b'''\
--1234
Foo
---1234--''').replace(b"\n", b"\r\n")
+--1234--'''.replace(b"\n", b"\r\n")
args = {}
files = {}
with ExpectLog(gen_log, "multipart/form-data missing headers"):
parse_multipart_form_data(b"1234", data, args, files)
self.assertEqual(files, {})
def test_invalid_content_disposition(self):
- data = b('''\
+ data = b'''\
--1234
Content-Disposition: invalid; name="files"; filename="ab.txt"
Foo
---1234--''').replace(b"\n", b"\r\n")
+--1234--'''.replace(b"\n", b"\r\n")
args = {}
files = {}
with ExpectLog(gen_log, "Invalid multipart/form-data"):
parse_multipart_form_data(b"1234", data, args, files)
self.assertEqual(files, {})
def test_line_does_not_end_with_correct_line_break(self):
- data = b('''\
+ data = b'''\
--1234
Content-Disposition: form-data; name="files"; filename="ab.txt"
-Foo--1234--''').replace(b"\n", b"\r\n")
+Foo--1234--'''.replace(b"\n", b"\r\n")
args = {}
files = {}
with ExpectLog(gen_log, "Invalid multipart/form-data"):
parse_multipart_form_data(b"1234", data, args, files)
self.assertEqual(files, {})
def test_content_disposition_header_without_name_parameter(self):
- data = b("""\
+ data = b"""\
--1234
Content-Disposition: form-data; filename="ab.txt"
Foo
---1234--""").replace(b"\n", b"\r\n")
+--1234--""".replace(b"\n", b"\r\n")
args = {}
files = {}
with ExpectLog(gen_log, "multipart/form-data value missing name"):
@@ -186,13 +185,13 @@ def test_data_after_final_boundary(self):
# The spec requires that data after the final boundary be ignored.
# http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
# In practice, some libraries include an extra CRLF after the boundary.
- data = b("""\
+ data = b"""\
--1234
Content-Disposition: form-data; name="files"; filename="ab.txt"
Foo
--1234--
-""").replace(b"\n", b"\r\n")
+""".replace(b"\n", b"\r\n")
args = {}
files = {}
parse_multipart_form_data(b"1234", data, args, files)
@@ -6,7 +6,6 @@
from tornado.stack_context import NullContext
from tornado.testing import AsyncHTTPTestCase, AsyncHTTPSTestCase, AsyncTestCase, bind_unused_port, ExpectLog
from tornado.test.util import unittest, skipIfNonUnix
-from tornado.util import b
from tornado.web import RequestHandler, Application
import errno
import logging
@@ -4,7 +4,7 @@
import tornado.locale
from tornado.escape import utf8
from tornado.test.util import unittest
-from tornado.util import b, u, unicode_type
+from tornado.util import u, unicode_type
class TranslationLoaderTest(unittest.TestCase):
View
@@ -27,7 +27,7 @@
from tornado.log import LogFormatter, define_logging_options, enable_pretty_logging
from tornado.options import OptionParser
from tornado.test.util import unittest
-from tornado.util import b, u, bytes_type, basestring_type
+from tornado.util import u, bytes_type, basestring_type
@contextlib.contextmanager
def ignore_bytes_warning():
@@ -15,7 +15,6 @@
from tornado.simple_httpclient import SimpleAsyncHTTPClient
from tornado.testing import bind_unused_port, ExpectLog, AsyncTestCase
from tornado.test.util import unittest, skipIfNonUnix
-from tornado.util import b
from tornado.web import RequestHandler, Application
@@ -19,7 +19,6 @@
from tornado.test import httpclient_test
from tornado.testing import AsyncHTTPTestCase, AsyncTestCase, bind_unused_port, ExpectLog
from tornado.test.util import unittest
-from tornado.util import b
from tornado.web import RequestHandler, Application, asynchronous, url
@@ -5,7 +5,6 @@
from tornado.stack_context import StackContext, wrap, NullContext
from tornado.testing import AsyncHTTPTestCase, AsyncTestCase, ExpectLog
from tornado.test.util import unittest
-from tornado.util import b
from tornado.web import asynchronous, Application, RequestHandler
import contextlib
import functools
@@ -7,7 +7,7 @@
from tornado.template import Template, DictLoader, ParseError, Loader
from tornado.testing import ExpectLog
from tornado.test.util import unittest
-from tornado.util import b, u, bytes_type, ObjectDict, unicode_type
+from tornado.util import u, bytes_type, ObjectDict, unicode_type
class TemplateTest(unittest.TestCase):
@@ -302,9 +302,9 @@ def test_default_off(self):
b"Bobby <table>s")
self.assertEqual(loader.load("include.html").generate(name=name),
- b("escaped: Bobby &lt;table&gt;s\n"
- "unescaped: Bobby <table>s\n"
- "default: Bobby <table>s\n"))
+ b"escaped: Bobby &lt;table&gt;s\n"
+ b"unescaped: Bobby <table>s\n"
+ b"default: Bobby <table>s\n")
def test_default_on(self):
loader = DictLoader(self.templates, autoescape="xhtml_escape")
@@ -317,9 +317,9 @@ def test_default_on(self):
b"Bobby &lt;table&gt;s")
self.assertEqual(loader.load("include.html").generate(name=name),
- b("escaped: Bobby &lt;table&gt;s\n"
- "unescaped: Bobby <table>s\n"
- "default: Bobby &lt;table&gt;s\n"))
+ b"escaped: Bobby &lt;table&gt;s\n"
+ b"unescaped: Bobby <table>s\n"
+ b"default: Bobby &lt;table&gt;s\n")
def test_unextended_block(self):
loader = DictLoader(self.templates)
@@ -350,8 +350,8 @@ def test_raw_expression(self):
def render(name):
return loader.load(name).generate(name='<>&"')
self.assertEqual(render("raw_expression.html"),
- b("expr: &lt;&gt;&amp;&quot;\n"
- "raw: <>&\""))
+ b"expr: &lt;&gt;&amp;&quot;\n"
+ b"raw: <>&\"")
def test_custom_escape(self):
loader = DictLoader({"foo.py":
@@ -367,9 +367,9 @@ def render(template, name):
self.assertEqual(render("foo.py", "<html>"),
b"s = '<html>'\n")
self.assertEqual(render("foo.py", "';sys.exit()"),
- b("""s = "';sys.exit()"\n"""))
+ b"""s = "';sys.exit()"\n""")
self.assertEqual(render("foo.py", ["not a string"]),
- b("""s = "['not a string']"\n"""))
+ b"""s = "['not a string']"\n""")
class TemplateLoaderTest(unittest.TestCase):
@@ -3,7 +3,7 @@
import sys
from tornado.escape import utf8
-from tornado.util import raise_exc_info, Configurable, u, b
+from tornado.util import raise_exc_info, Configurable, u
from tornado.test.util import unittest
Oops, something went wrong.

0 comments on commit 9253026

Please sign in to comment.