Skip to content
This repository has been archived by the owner on May 21, 2020. It is now read-only.

Commit

Permalink
Update to version 2.4
Browse files Browse the repository at this point in the history
Merge commit '648bebf0eeb220ebfaa8200bab3bac41add9d650' into streambody

Conflicts:
	tornado/httpserver.py
  • Loading branch information
jcbsv committed Sep 20, 2012
2 parents 6df83f7 + 648bebf commit 581def2
Show file tree
Hide file tree
Showing 69 changed files with 1,425 additions and 475 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
*.pyc
*.pyo
*.so
*.class
*~
Expand Down
23 changes: 20 additions & 3 deletions .travis.yml
@@ -1,12 +1,29 @@
# http://travis-ci.org/#!/facebook/tornado
language: python
# The build of 2.6 on travis has a bug related to ssl (it segfaults in
# test_sslv2_fail)
python:
- 2.5
- 2.6
- 2.7
- pypy
- 3.2
# TODO: install pycurl, twisted, etc (depends on python version)
matrix:
include:
- python: 2.5
env: FULL="true"
- python: 2.6
env: FULL="true"
- python: 2.7
env: FULL="true"
- python: 3.2
env: LANG="en_US.utf-8"
- python: 3.2
env: LANG="C"
install:
- if [[ $TRAVIS_PYTHON_VERSION == '2.5' ]]; then pip install --use-mirrors simplejson; fi
- if [[ $FULL == 'true' ]]; then sudo apt-get install librtmp-dev; pip install --use-mirrors MySQL-python pycurl; fi
- if [[ $FULL == 'true' && $TRAVIS_PYTHON_VERSION == '2.5' ]]; then pip install --use-mirrors twisted==11.0.0 'zope.interface<4.0'; fi
- if [[ $FULL == 'true' && $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install --use-mirrors twisted==11.0.0; fi
- if [[ $FULL == 'true' && $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install --use-mirrors twisted==12.0.0; fi
- python setup.py install
script:
# Must cd somewhere else so python3 doesn't get confused and run
Expand Down
4 changes: 4 additions & 0 deletions MANIFEST.in
Expand Up @@ -4,6 +4,10 @@ include tornado/ca-certificates.crt
include tornado/test/README
include tornado/test/test.crt
include tornado/test/test.key
include tornado/test/csv_translations/fr_FR.csv
include tornado/test/gettext_translations/fr_FR/LC_MESSAGES/tornado_test.mo
include tornado/test/gettext_translations/fr_FR/LC_MESSAGES/tornado_test.po
include tornado/test/static/robots.txt
include tornado/test/templates/utf8.html
include runtests.sh
global-exclude _auto2to3*
49 changes: 36 additions & 13 deletions README
Expand Up @@ -7,26 +7,49 @@ available at http://www.tornadoweb.org/
Tornado is licensed under the Apache Licence, Version 2.0
(http://www.apache.org/licenses/LICENSE-2.0.html).

Installation
============
To install:
Automatic installation
----------------------

Tornado is listed in PyPI and can be installed with pip or
easy_install. Note that the source distribution includes demo
applications that are not present when Tornado is installed in this
way, so you may wish to download a copy of the source tarball as well.

Manual installation
-------------------

Download https://github.com/downloads/facebook/tornado/tornado-2.3.tar.gz

tar xvzf tornado-2.3.tar.gz
cd tornado-2.3
python setup.py build
sudo python setup.py install

Tornado has been tested on Python 2.5 and 2.6. To use all of the features
of Tornado, you need to have PycURL and (for Python 2.5 only) simplejson
installed.
The Tornado source code is hosted on GitHub: https://github.com/facebook/tornado

On Python 2.6 and 2.7, it is also possible to simply add the tornado
directory to your PYTHONPATH instead of building with setup.py, since
the standard library includes epoll support.

Prerequisites
-------------

On Mac OS X 10.6, you can install the packages with:
Tornado runs on Python 2.5, 2.6, 2.7 and 3.2.

sudo easy_install pycurl
On Python 2.6 and 2.7, there are no dependencies outside the Python
standard library, although PycURL (version 7.18.2 or higher required;
version 7.21.1 or higher recommended) may be used if desired.

On Ubuntu Linux, you can install the packages with:
On Python 2.5, PycURL is required, along with simplejson and the
Python development headers (typically obtained by installing a package
named something like python-dev from your operating system).

# Python 2.6
sudo apt-get install python-pycurl
On Python 3.2, the distribute package is required. Note that Python 3
support is relatively new and may have bugs.

# Python 2.5
sudo apt-get install python-dev python-pycurl python-simplejson
Platforms
---------

Tornado should run on any Unix-like platform, although for the best
performance and scalability only Linux and BSD (including BSD
derivatives like Mac OS X) are recommended.
13 changes: 10 additions & 3 deletions demos/auth/authdemo.py
Expand Up @@ -34,7 +34,7 @@ def __init__(self):
(r"/auth/logout", LogoutHandler),
]
settings = dict(
cookie_secret="32oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
cookie_secret="__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
login_url="/auth/login",
)
tornado.web.Application.__init__(self, handlers, **settings)
Expand Down Expand Up @@ -62,17 +62,24 @@ def get(self):
self.get_authenticated_user(self.async_callback(self._on_auth))
return
self.authenticate_redirect()

def _on_auth(self, user):
if not user:
raise tornado.web.HTTPError(500, "Google auth failed")
self.set_secure_cookie("user", tornado.escape.json_encode(user))
self.redirect("/")


class LogoutHandler(BaseHandler):
def get(self):
# This logs the user out of this demo app, but does not log them
# out of Google. Since Google remembers previous authorizations,
# returning to this app will log them back in immediately with no
# interaction (unless they have separately logged out of Google in
# the meantime).
self.clear_cookie("user")
self.redirect("/")
self.write('You are now logged out. '
'Click <a href="/">here</a> to log back in.')

def main():
tornado.options.parse_command_line()
Expand Down
2 changes: 1 addition & 1 deletion demos/blog/blog.py
Expand Up @@ -51,7 +51,7 @@ def __init__(self):
static_path=os.path.join(os.path.dirname(__file__), "static"),
ui_modules={"Entry": EntryModule},
xsrf_cookies=True,
cookie_secret="11oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
cookie_secret="__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
login_url="/auth/login",
autoescape=None,
)
Expand Down
2 changes: 1 addition & 1 deletion demos/chat/chatdemo.py
Expand Up @@ -38,7 +38,7 @@ def __init__(self):
(r"/a/message/updates", MessageUpdatesHandler),
]
settings = dict(
cookie_secret="43oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
cookie_secret="__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
login_url="/auth/login",
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
Expand Down
2 changes: 1 addition & 1 deletion demos/facebook/facebook.py
Expand Up @@ -39,7 +39,7 @@ def __init__(self):
(r"/auth/logout", AuthLogoutHandler),
]
settings = dict(
cookie_secret="12oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
cookie_secret="__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
login_url="/auth/login",
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
Expand Down
2 changes: 1 addition & 1 deletion demos/websocket/chatdemo.py
Expand Up @@ -39,7 +39,7 @@ def __init__(self):
(r"/chatsocket", ChatSocketHandler),
]
settings = dict(
cookie_secret="43oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
cookie_secret="__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
xsrf_cookies=True,
Expand Down
22 changes: 11 additions & 11 deletions maint/requirements.txt
Expand Up @@ -2,22 +2,22 @@

# Tornado's optional dependencies
MySQL-python==1.2.3
Twisted==11.1.0
Twisted==12.1.0
pycurl==7.19.0

# Other useful tools
Sphinx==1.1.2
autopep8==0.5
coverage==3.5.1
pep8==0.6.1
Sphinx==1.1.3
autopep8==0.6.5
coverage==3.5.2
pep8==1.2
pyflakes==0.5.0
tox==1.3
virtualenv==1.7
tox==1.4
virtualenv==1.7.1.2

# Indirect dependencies
Jinja2==2.6
Pygments==1.4
docutils==0.8.1
py==1.4.6
Pygments==1.5
docutils==0.9.1
py==1.4.9
wsgiref==0.1.2
zope.interface==3.8.0
zope.interface==4.0.1
3 changes: 2 additions & 1 deletion maint/scripts/run_autopep8.sh
Expand Up @@ -5,4 +5,5 @@
# W602 is "deprecated form of raising exception", but the fix is incorrect
# (and I'm not sure if the three-argument form of raise is really deprecated
# in the first place)
autopep8 --ignore=W602 -i tornado/*.py tornado/platform/*.py tornado/test/*.py
# E501 is "line longer than 80 chars" but the automated fix is ugly.
autopep8 --ignore=W602,E501 -i tornado/*.py tornado/platform/*.py tornado/test/*.py
2 changes: 1 addition & 1 deletion maint/test/websocket/client.py
Expand Up @@ -3,7 +3,7 @@
from tornado.options import options, define, parse_command_line
from twisted.python import log
from twisted.internet import reactor
from autobahn.fuzzing import FuzzingClientFactory
from autobahntestsuite.fuzzing import FuzzingClientFactory

define('servers', type=str, multiple=True,
default=['Tornado=ws://localhost:9000'])
Expand Down
2 changes: 1 addition & 1 deletion maint/test/websocket/tox.ini
Expand Up @@ -9,4 +9,4 @@ setupdir=../../..
commands = python -c pass

[testenv:py27]
deps = autobahn
deps = autobahntestsuite
10 changes: 10 additions & 0 deletions runtests.sh
@@ -0,0 +1,10 @@
#!/bin/sh

cd $(dirname $0)

# "python -m" differs from "python tornado/test/runtests.py" in how it sets
# up the default python path. "python -m" uses the current directory,
# while "python file.py" uses the directory containing "file.py" (which is
# not what you want if file.py appears within a package you want to import
# from)
python -m tornado.test.runtests "$@"
17 changes: 14 additions & 3 deletions setup.py
Expand Up @@ -33,7 +33,7 @@
extensions.append(distutils.core.Extension(
"tornado.epoll", ["tornado/epoll.c"]))

version = "2.3"
version = "2.4"

if major >= 3:
import setuptools # setuptools is required for use_2to3
Expand All @@ -45,8 +45,19 @@
packages = ["tornado", "tornado.test", "tornado.platform"],
package_data = {
"tornado": ["ca-certificates.crt"],
"tornado.test": ["README", "test.crt", "test.key", "static/robots.txt",
"templates/utf8.html"],
# data files need to be listed both here (which determines what gets
# installed) and in MANIFEST.in (which determines what gets included
# in the sdist tarball)
"tornado.test": [
"README",
"test.crt",
"test.key",
"static/robots.txt",
"templates/utf8.html",
"csv_translations/fr_FR.csv",
"gettext_translations/fr_FR/LC_MESSAGES/tornado_test.mo",
"gettext_translations/fr_FR/LC_MESSAGES/tornado_test.po",
],
},
ext_modules = extensions,
author="Facebook",
Expand Down
4 changes: 2 additions & 2 deletions tornado/__init__.py
Expand Up @@ -25,5 +25,5 @@
# is zero for an official release, positive for a development branch,
# or negative for a release candidate (after the base version number
# has been incremented)
version = "2.3"
version_info = (2, 3, 0, 0)
version = "2.4"
version_info = (2, 4, 0, 0)
30 changes: 19 additions & 11 deletions tornado/auth.py
Expand Up @@ -203,6 +203,9 @@ def get_ax_arg(uri):
user["locale"] = locale
if username:
user["username"] = username
claimed_id = self.get_argument("openid.claimed_id", None)
if claimed_id:
user["claimed_id"] = claimed_id
callback(user)


Expand Down Expand Up @@ -282,14 +285,16 @@ def _oauth_request_token_url(self, callback_uri=None, extra_params=None):
consumer_token = self._oauth_consumer_token()
url = self._OAUTH_REQUEST_TOKEN_URL
args = dict(
oauth_consumer_key=consumer_token["key"],
oauth_consumer_key=escape.to_basestring(consumer_token["key"]),
oauth_signature_method="HMAC-SHA1",
oauth_timestamp=str(int(time.time())),
oauth_nonce=binascii.b2a_hex(uuid.uuid4().bytes),
oauth_nonce=escape.to_basestring(binascii.b2a_hex(uuid.uuid4().bytes)),
oauth_version=getattr(self, "_OAUTH_VERSION", "1.0a"),
)
if getattr(self, "_OAUTH_VERSION", "1.0a") == "1.0a":
if callback_uri:
if callback_uri == "oob":
args["oauth_callback"] = "oob"
elif callback_uri:
args["oauth_callback"] = urlparse.urljoin(
self.request.full_url(), callback_uri)
if extra_params:
Expand All @@ -309,7 +314,10 @@ def _on_request_token(self, authorize_url, callback_uri, response):
base64.b64encode(request_token["secret"]))
self.set_cookie("_oauth_request_token", data)
args = dict(oauth_token=request_token["key"])
if callback_uri:
if callback_uri == "oob":
self.finish(authorize_url + "?" + urllib.urlencode(args))
return
elif callback_uri:
args["oauth_callback"] = urlparse.urljoin(
self.request.full_url(), callback_uri)
self.redirect(authorize_url + "?" + urllib.urlencode(args))
Expand All @@ -318,11 +326,11 @@ def _oauth_access_token_url(self, request_token):
consumer_token = self._oauth_consumer_token()
url = self._OAUTH_ACCESS_TOKEN_URL
args = dict(
oauth_consumer_key=consumer_token["key"],
oauth_token=request_token["key"],
oauth_consumer_key=escape.to_basestring(consumer_token["key"]),
oauth_token=escape.to_basestring(request_token["key"]),
oauth_signature_method="HMAC-SHA1",
oauth_timestamp=str(int(time.time())),
oauth_nonce=binascii.b2a_hex(uuid.uuid4().bytes),
oauth_nonce=escape.to_basestring(binascii.b2a_hex(uuid.uuid4().bytes)),
oauth_version=getattr(self, "_OAUTH_VERSION", "1.0a"),
)
if "verifier" in request_token:
Expand Down Expand Up @@ -367,11 +375,11 @@ def _oauth_request_parameters(self, url, access_token, parameters={},
"""
consumer_token = self._oauth_consumer_token()
base_args = dict(
oauth_consumer_key=consumer_token["key"],
oauth_token=access_token["key"],
oauth_consumer_key=escape.to_basestring(consumer_token["key"]),
oauth_token=escape.to_basestring(access_token["key"]),
oauth_signature_method="HMAC-SHA1",
oauth_timestamp=str(int(time.time())),
oauth_nonce=binascii.b2a_hex(uuid.uuid4().bytes),
oauth_nonce=escape.to_basestring(binascii.b2a_hex(uuid.uuid4().bytes)),
oauth_version=getattr(self, "_OAUTH_VERSION", "1.0a"),
)
args = {}
Expand Down Expand Up @@ -854,7 +862,7 @@ def get_authenticated_user(self, callback):
self._on_get_user_info, callback, session),
session_key=session["session_key"],
uids=session["uid"],
fields="uid,first_name,last_name,name,locale,pic_square," \
fields="uid,first_name,last_name,name,locale,pic_square,"
"profile_url,username")

def facebook_request(self, method, callback, **args):
Expand Down
5 changes: 5 additions & 0 deletions tornado/autoreload.py
Expand Up @@ -24,6 +24,11 @@
This module depends on IOLoop, so it will not work in WSGI applications
and Google AppEngine. It also will not work correctly when HTTPServer's
multi-process mode is used.
Reloading loses any Python interpreter command-line arguments (e.g. ``-u``)
because it re-executes Python using ``sys.executable`` and ``sys.argv``.
Additionally, modifying these variables will cause reloading to behave
incorrectly.
"""

from __future__ import absolute_import, division, with_statement
Expand Down

0 comments on commit 581def2

Please sign in to comment.