Skip to content
Myr

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

2 files+12 added−9 removed

modified:tests/flask_tests.py+8 added-7 removed
14 unmodified lines
15import sys16import flask17import unittest18import tempfile19import warnings19from datetime import datetime20from werkzeug import parse_date2122
36 unmodified lines
59 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 == 405
15 unmodified lines
83 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 == 405
97 unmodified lines
189 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 lines
234 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 lines
296 assert rv.data == '3'297298 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>"'306307308class TemplatingTestCase(unittest.TestCase):
153 unmodified lines
modified:flask.py+4 added-2 removed
92 unmodified lines
93 pass949596class 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 """100101 def _get_permanent(self):102 return self.get('_permanent', False)103104 def _set_permanent(self, value):105 self['_permanent'] = bool(value)106107 permanent = property(_get_permanent, _set_permanent)108 del _get_permanent, _set_permanent109110
471 unmodified lines
582 #: currently logged in user. To register a function here, use the583 #: :meth:`before_request` decorator.584 self.after_request_funcs = {}585584 #: 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 the
451 unmodified lines