From: Akihiro Yamazaki Date: Fri, 2 Sep 2016 05:52:06 +0000 (+0900) Subject: use print function insted of stetement at doc-string X-Git-Tag: v4.5.0~73^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d72786d8f4497f5afe90d07c3d71b6b33e4ec22;p=thirdparty%2Ftornado.git use print function insted of stetement at doc-string --- diff --git a/tornado/httpclient.py b/tornado/httpclient.py index 762919ee8..59dcdf659 100644 --- a/tornado/httpclient.py +++ b/tornado/httpclient.py @@ -61,7 +61,7 @@ class HTTPClient(object): http_client = httpclient.HTTPClient() try: response = http_client.fetch("http://www.google.com/") - print response.body + print(response.body) except httpclient.HTTPError as e: # HTTPError is raised for non-200 responses; the response # can be found in e.response. @@ -110,9 +110,9 @@ class AsyncHTTPClient(Configurable): def handle_response(response): if response.error: - print "Error:", response.error + print("Error:", response.error) else: - print response.body + print(response.body) http_client = AsyncHTTPClient() http_client.fetch("http://www.google.com/", handle_response) diff --git a/tornado/locale.py b/tornado/locale.py index 4f80fd366..c1cb6792b 100644 --- a/tornado/locale.py +++ b/tornado/locale.py @@ -19,7 +19,7 @@ To load a locale and generate a translated string:: user_locale = tornado.locale.get("es_LA") - print user_locale.translate("Sign out") + print(user_locale.translate("Sign out")) `tornado.locale.get()` returns the closest matching locale, not necessarily the specific locale you requested. You can support pluralization with @@ -28,7 +28,7 @@ additional arguments to `~Locale.translate()`, e.g.:: people = [...] message = user_locale.translate( "%(list)s is online", "%(list)s are online", len(people)) - print message % {"list": user_locale.list(people)} + print(message % {"list": user_locale.list(people)}) The first string is chosen if ``len(people) == 1``, otherwise the second string is chosen. diff --git a/tornado/template.py b/tornado/template.py index cbb296a3a..67c61e6b5 100644 --- a/tornado/template.py +++ b/tornado/template.py @@ -19,13 +19,13 @@ Basic usage looks like:: t = template.Template("{{ myvalue }}") - print t.generate(myvalue="XXX") + print(t.generate(myvalue="XXX")) `Loader` is a class that loads templates from a root directory and caches the compiled templates:: loader = template.Loader("/home/btaylor") - print loader.load("test.html").generate(myvalue="XXX") + print(loader.load("test.html").generate(myvalue="XXX")) We compile all templates to raw Python. Error-reporting is currently... uh, interesting. Syntax for the templates::