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 9da5795, 67fc465 · Browse files · 2 files·+12 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+12 added−9 removed
- tests:+8 added−7 removed
- other:+4 added−2 removed
Provenance
- Commit
720bede- Tree
c684fdd- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent 1
9da5795- Parent 2
67fc465
2 files changed+12 added−9 removed
modified:tests/flask_tests.py+8 added-7 removed
14 unmodified lines15 import sys16 import flask17 import unittest18 import tempfile19-import warnings19 from datetime import datetime20 from werkzeug import parse_date21 22 36 unmodified lines59 assert rv.status_code == 40560 assert sorted(rv.allow) == ['GET', 'HEAD']61 rv = c.head('/')62 assert rv.status_code == 20064- assert not rv.data # head truncates63+ assert not rv.data # head truncates64 assert c.post('/more').data == 'POST'65 assert c.get('/more').data == 'GET'66 rv = c.delete('/more')67 assert rv.status_code == 40515 unmodified lines83 assert rv.status_code == 40584 assert sorted(rv.allow) == ['GET', 'HEAD']85 rv = c.head('/')86 assert rv.status_code == 20088- assert not rv.data # head truncates87+ assert not rv.data # head truncates88 assert c.post('/more').data == 'POST'89 assert c.get('/more').data == 'GET'90 rv = c.delete('/more')91 assert rv.status_code == 40597 unmodified lines189 def index():190 flask.abort(404)191 @app.route('/error')192 def error():194- 1/0193+ 1 // 0194 c = app.test_client()195 rv = c.get('/')196 assert rv.status_code == 404197 assert rv.data == 'not found'36 unmodified lines234 class ListConverter(BaseConverter):235 def to_python(self, value):236 return value.split(',')237 def to_url(self, value):238+ base_to_url = super(ListConverter, self).to_url239- return ','.join(super(ListConverter, self).to_url(x) for x in value)239+ return ','.join(base_to_url(x) for x in value)240 app = flask.Flask(__name__)241 app.url_map.converters['list'] = ListConverter242 @app.route('/<list:args>')243 def index(args):52 unmodified lines296 assert rv.data == '3'297 298 def test_template_escaping(self):299 app = flask.Flask(__name__)300+ render = flask.render_template_string301 with app.test_request_context():301- rv = flask.render_template_string('{{ "</script>"|tojson|safe }}')302+ rv = render('{{ "</script>"|tojson|safe }}')303 assert rv == '"<\\/script>"'303- rv = flask.render_template_string('{{ "<\0/script>"|tojson|safe }}')304+ rv = render('{{ "<\0/script>"|tojson|safe }}')305 assert rv == '"<\\u0000\\/script>"'306 307 308 class TemplatingTestCase(unittest.TestCase):153 unmodified linesmodified:flask.py+4 added-2 removed
92 unmodified lines93 pass94 95 96 class Session(SecureCookie):97- """Expands the session for support for switching between permanent97+ """Expands the session with support for switching between permanent98 and non-permanent sessions.99 """100 101 def _get_permanent(self):102 return self.get('_permanent', False)103+104 def _set_permanent(self, value):105 self['_permanent'] = bool(value)106+107 permanent = property(_get_permanent, _set_permanent)108 del _get_permanent, _set_permanent109 110 471 unmodified lines582 #: currently logged in user. To register a function here, use the583 #: :meth:`before_request` decorator.584 self.after_request_funcs = {}585 584- #: a dictionary with list of functions that are called without arguments586+ #: a dictionary with list of functions that are called without argument587 #: to populate the template context. They key of the dictionary is the588 #: name of the module this function is active for, `None` for all589 #: requests. Each returns a dictionary that the template context is590 #: updated with. To register a function here, use the451 unmodified lines