Merge branch 'master' into module-support
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Armin Ronacher · committed by Armin Ronacher · parents c0a9f5d, ef34638 · Browse files · 4 files·+42 added−10 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+42 added−10 removed
- tests:+14 added−0 removed
- other:+28 added−10 removed
Provenance
- Commit
5144d3b- Tree
3ff03d9- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent 1
c0a9f5d- Parent 2
ef34638
4 files changed+42 added−10 removed
modified:docs/tutorial/setup.rst+4 added-9 removed
55 unmodified lines56 without problems. When you head over to the server you will get an 40457 page not found error because we don't have any views yet. But we will58 focus on that a little later. First we should get the database working.59 60-.. admonition:: Troubleshooting60+.. admonition:: Externally Visible Server61 62- If you notice later that the browser cannot connect to the server63- during development, you might want to try this line instead::64-65- app.run(host='127.0.0.1')66-67- In a nutshell: Werkzeug starts up as IPv6 on many operating systems by68- default and not every browser is happy with that. This forces IPv469- usage.62+ Want your server to be publically available? Check out the63+ :ref:`externally visible server <public-server>` section for more64+ information.modified:docs/quickstart.rst+18 added
52 unmodified lines53 the Python interpreter and not used as imported module.54 55 To stop the server, hit control-C.56 57+.. _public-server:58 59+.. admonition:: Externally Visible Server60+61+ If you run the server you will notice that the server is only available62+ from your own computer, not from any other in the network. This is the63+ default because in debugging mode a user of the application can execute64+ arbitrary Python code on your computer. If you have `debug` disabled65+ or trust the users on your network, you can make the server publicly66+ available.67+68+ Just change the call of the :meth:`~flask.Flask.run` method to look69+ like this::70+71+ app.run(host='0.0.0.0')72+73+ This tells your operating system to listen on a public IP.74+75+76 Debug Mode77 ----------78 79 Now that :meth:`~flask.Flask.run` method is nice to start a local557 unmodified linesmodified:tests/flask_tests.py+14 added
13 unmodified lines14 import sys15 import flask16 import unittest17 import tempfile18+import warnings19 20 21 example_path = os.path.join(os.path.dirname(__file__), '..', 'examples')22 sys.path.append(os.path.join(example_path, 'flaskr'))201 unmodified lines224 with app.test_request_context():225 assert flask.url_for('static', filename='index.html') \226 == '/static/index.html'227 228+ def test_none_response(self):229+ warnings.filterwarnings('error', 'View function did not return')230+ app = flask.Flask(__name__)231+ @app.route('/')232+ def test():233+ return None234+ try:235+ app.test_client().get('/')236+ except Warning:237+ pass238+ else:239+ assert "Expected warning"240 241+242 class JSONTestCase(unittest.TestCase):243 244 def test_jsonify(self):245 d = dict(a=23, b=42, c=[1, 2, 3])146 unmodified linesmodified:flask.py+6 added-1 removed
848 unmodified lines849 def make_response(self, rv):850 """Converts the return value from a view function to a real851 response object that is an instance of :attr:`response_class`.852 853- The following types are allowd for `rv`:853+ The following types are allowed for `rv`:854 855 ======================= ===========================================856 :attr:`response_class` the object is returned unchanged857 :class:`str` a response object is created with the7 unmodified lines865 ======================= ===========================================866 867 :param rv: the return value from the view function868 """869+ if rv is None:870+ from warnings import warn871+ warn(Warning('View function did not return a response'),872+ stacklevel=2)873+ return u''874 if isinstance(rv, self.response_class):875 return rv876 if isinstance(rv, basestring):877 return self.response_class(rv)102 unmodified lines