Skip to content

Commit

Permalink
Fix typo, remove useless import, limit lines to 79 columns.
Browse files Browse the repository at this point in the history
  • Loading branch information
florentx authored and mitsuhiko committed May 3, 2010
1 parent f345af8 commit 67fc465
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
6 changes: 4 additions & 2 deletions flask.py
Expand Up @@ -87,14 +87,16 @@ class _RequestGlobals(object):


class Session(SecureCookie):
"""Expands the session for support for switching between permanent
"""Expands the session with support for switching between permanent
and non-permanent sessions.
"""

def _get_permanent(self):
return self.get('_permanent', False)

def _set_permanent(self, value):
self['_permanent'] = bool(value)

permanent = property(_get_permanent, _set_permanent)
del _get_permanent, _set_permanent

Expand Down Expand Up @@ -391,7 +393,7 @@ def __init__(self, package_name):
#: decorator.
self.after_request_funcs = []

#: a list of functions that are called without arguments
#: a list of functions that are called without argument
#: to populate the template context. Each returns a dictionary
#: that the template context is updated with.
#: To register a function here, use the :meth:`context_processor`
Expand Down
15 changes: 8 additions & 7 deletions tests/flask_tests.py
Expand Up @@ -16,7 +16,6 @@
import flask
import unittest
import tempfile
import warnings
from datetime import datetime
from werkzeug import parse_date

Expand Down Expand Up @@ -61,7 +60,7 @@ def more():
assert sorted(rv.allow) == ['GET', 'HEAD']
rv = c.head('/')
assert rv.status_code == 200
assert not rv.data # head truncates
assert not rv.data # head truncates
assert c.post('/more').data == 'POST'
assert c.get('/more').data == 'GET'
rv = c.delete('/more')
Expand All @@ -85,7 +84,7 @@ def more():
assert sorted(rv.allow) == ['GET', 'HEAD']
rv = c.head('/')
assert rv.status_code == 200
assert not rv.data # head truncates
assert not rv.data # head truncates
assert c.post('/more').data == 'POST'
assert c.get('/more').data == 'GET'
rv = c.delete('/more')
Expand Down Expand Up @@ -191,7 +190,7 @@ def index():
flask.abort(404)
@app.route('/error')
def error():
1/0
1 // 0
c = app.test_client()
rv = c.get('/')
assert rv.status_code == 404
Expand Down Expand Up @@ -236,7 +235,8 @@ class ListConverter(BaseConverter):
def to_python(self, value):
return value.split(',')
def to_url(self, value):
return ','.join(super(ListConverter, self).to_url(x) for x in value)
base_to_url = super(ListConverter, self).to_url
return ','.join(base_to_url(x) for x in value)
app = flask.Flask(__name__)
app.url_map.converters['list'] = ListConverter
@app.route('/<list:args>')
Expand Down Expand Up @@ -297,10 +297,11 @@ def add():

def test_template_escaping(self):
app = flask.Flask(__name__)
render = flask.render_template_string
with app.test_request_context():
rv = flask.render_template_string('{{ "</script>"|tojson|safe }}')
rv = render('{{ "</script>"|tojson|safe }}')
assert rv == '"<\\/script>"'
rv = flask.render_template_string('{{ "<\0/script>"|tojson|safe }}')
rv = render('{{ "<\0/script>"|tojson|safe }}')
assert rv == '"<\\u0000\\/script>"'


Expand Down

0 comments on commit 67fc465

Please sign in to comment.