forked from orbit-oss/flask
fix string concats left over by black
This commit is contained in:
parent
3db4697959
commit
53c893b646
10 changed files with 17 additions and 18 deletions
|
|
@ -74,7 +74,7 @@ def create():
|
||||||
else:
|
else:
|
||||||
db = get_db()
|
db = get_db()
|
||||||
db.execute(
|
db.execute(
|
||||||
"INSERT INTO post (title, body, author_id)" " VALUES (?, ?, ?)",
|
"INSERT INTO post (title, body, author_id) VALUES (?, ?, ?)",
|
||||||
(title, body, g.user["id"]),
|
(title, body, g.user["id"]),
|
||||||
)
|
)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
|
||||||
|
|
@ -1931,7 +1931,7 @@ class Flask(_PackageBoundObject):
|
||||||
if not from_error_handler:
|
if not from_error_handler:
|
||||||
raise
|
raise
|
||||||
self.logger.exception(
|
self.logger.exception(
|
||||||
"Request finalizing failed with an " "error while handling an error"
|
"Request finalizing failed with an error while handling an error"
|
||||||
)
|
)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,7 @@ def get_version(ctx, param, value):
|
||||||
import werkzeug
|
import werkzeug
|
||||||
from . import __version__
|
from . import __version__
|
||||||
|
|
||||||
message = "Python %(python)s\n" "Flask %(flask)s\n" "Werkzeug %(werkzeug)s"
|
message = "Python %(python)s\nFlask %(flask)s\nWerkzeug %(werkzeug)s"
|
||||||
click.echo(
|
click.echo(
|
||||||
message
|
message
|
||||||
% {
|
% {
|
||||||
|
|
|
||||||
|
|
@ -437,9 +437,10 @@ class RequestContext(object):
|
||||||
if app_ctx is not None:
|
if app_ctx is not None:
|
||||||
app_ctx.pop(exc)
|
app_ctx.pop(exc)
|
||||||
|
|
||||||
assert (
|
assert rv is self, "Popped wrong request context. (%r instead of %r)" % (
|
||||||
rv is self
|
rv,
|
||||||
), "Popped wrong request context. " "(%r instead of %r)" % (rv, self)
|
self,
|
||||||
|
)
|
||||||
|
|
||||||
def auto_pop(self, exc):
|
def auto_pop(self, exc):
|
||||||
if self.request.environ.get("flask._preserve_context") or (
|
if self.request.environ.get("flask._preserve_context") or (
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ def _endpoint_from_view_func(view_func):
|
||||||
"""Internal helper that returns the default endpoint for a given
|
"""Internal helper that returns the default endpoint for a given
|
||||||
function. This always is the function name.
|
function. This always is the function name.
|
||||||
"""
|
"""
|
||||||
assert view_func is not None, "expected view func if endpoint " "is not provided."
|
assert view_func is not None, "expected view func if endpoint is not provided."
|
||||||
return view_func.__name__
|
return view_func.__name__
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -598,9 +598,7 @@ def send_file(
|
||||||
headers = Headers()
|
headers = Headers()
|
||||||
if as_attachment:
|
if as_attachment:
|
||||||
if attachment_filename is None:
|
if attachment_filename is None:
|
||||||
raise TypeError(
|
raise TypeError("filename unavailable, required for sending as attachment")
|
||||||
"filename unavailable, required for " "sending as attachment"
|
|
||||||
)
|
|
||||||
|
|
||||||
if not isinstance(attachment_filename, text_type):
|
if not isinstance(attachment_filename, text_type):
|
||||||
attachment_filename = attachment_filename.decode("utf-8")
|
attachment_filename = attachment_filename.decode("utf-8")
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ class FlaskClient(Client):
|
||||||
"""
|
"""
|
||||||
if self.cookie_jar is None:
|
if self.cookie_jar is None:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Session transactions only make sense " "with cookies enabled."
|
"Session transactions only make sense with cookies enabled."
|
||||||
)
|
)
|
||||||
app = self.application
|
app = self.application
|
||||||
environ_overrides = kwargs.setdefault("environ_overrides", {})
|
environ_overrides = kwargs.setdefault("environ_overrides", {})
|
||||||
|
|
@ -167,7 +167,7 @@ class FlaskClient(Client):
|
||||||
sess = session_interface.open_session(app, c.request)
|
sess = session_interface.open_session(app, c.request)
|
||||||
if sess is None:
|
if sess is None:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Session backend did not open a session. " "Check the configuration"
|
"Session backend did not open a session. Check the configuration"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Since we have to open a new request context for the session
|
# Since we have to open a new request context for the session
|
||||||
|
|
|
||||||
|
|
@ -1726,7 +1726,7 @@ def test_routing_redirect_debugging(app, client):
|
||||||
with pytest.raises(AssertionError) as e:
|
with pytest.raises(AssertionError) as e:
|
||||||
client.post("/foo", data={})
|
client.post("/foo", data={})
|
||||||
assert "http://localhost/foo/" in str(e)
|
assert "http://localhost/foo/" in str(e)
|
||||||
assert ("Make sure to directly send " "your POST-request to this URL") in str(e)
|
assert ("Make sure to directly send your POST-request to this URL") in str(e)
|
||||||
|
|
||||||
rv = client.get("/foo", data={}, follow_redirects=True)
|
rv = client.get("/foo", data={}, follow_redirects=True)
|
||||||
assert rv.data == b"success"
|
assert rv.data == b"success"
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ def test_config_from_envvar_missing(monkeypatch):
|
||||||
app.config.from_envvar("FOO_SETTINGS")
|
app.config.from_envvar("FOO_SETTINGS")
|
||||||
msg = str(e.value)
|
msg = str(e.value)
|
||||||
assert msg.startswith(
|
assert msg.startswith(
|
||||||
"[Errno 2] Unable to load configuration " "file (No such file or directory):"
|
"[Errno 2] Unable to load configuration file (No such file or directory):"
|
||||||
)
|
)
|
||||||
assert msg.endswith("missing.cfg'")
|
assert msg.endswith("missing.cfg'")
|
||||||
assert not app.config.from_envvar("FOO_SETTINGS", silent=True)
|
assert not app.config.from_envvar("FOO_SETTINGS", silent=True)
|
||||||
|
|
@ -110,7 +110,7 @@ def test_config_missing():
|
||||||
app.config.from_pyfile("missing.cfg")
|
app.config.from_pyfile("missing.cfg")
|
||||||
msg = str(e.value)
|
msg = str(e.value)
|
||||||
assert msg.startswith(
|
assert msg.startswith(
|
||||||
"[Errno 2] Unable to load configuration " "file (No such file or directory):"
|
"[Errno 2] Unable to load configuration file (No such file or directory):"
|
||||||
)
|
)
|
||||||
assert msg.endswith("missing.cfg'")
|
assert msg.endswith("missing.cfg'")
|
||||||
assert not app.config.from_pyfile("missing.cfg", silent=True)
|
assert not app.config.from_pyfile("missing.cfg", silent=True)
|
||||||
|
|
@ -122,7 +122,7 @@ def test_config_missing_json():
|
||||||
app.config.from_json("missing.json")
|
app.config.from_json("missing.json")
|
||||||
msg = str(e.value)
|
msg = str(e.value)
|
||||||
assert msg.startswith(
|
assert msg.startswith(
|
||||||
"[Errno 2] Unable to load configuration " "file (No such file or directory):"
|
"[Errno 2] Unable to load configuration file (No such file or directory):"
|
||||||
)
|
)
|
||||||
assert msg.endswith("missing.json'")
|
assert msg.endswith("missing.json'")
|
||||||
assert not app.config.from_json("missing.json", silent=True)
|
assert not app.config.from_json("missing.json", silent=True)
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ def test_installed_module_paths(
|
||||||
modules_tmpdir, modules_tmpdir_prefix, purge_module, site_packages, limit_loader
|
modules_tmpdir, modules_tmpdir_prefix, purge_module, site_packages, limit_loader
|
||||||
):
|
):
|
||||||
site_packages.join("site_app.py").write(
|
site_packages.join("site_app.py").write(
|
||||||
"import flask\n" "app = flask.Flask(__name__)\n"
|
"import flask\napp = flask.Flask(__name__)\n"
|
||||||
)
|
)
|
||||||
purge_module("site_app")
|
purge_module("site_app")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ def test_request_less_rendering(app, app_ctx):
|
||||||
def context_processor():
|
def context_processor():
|
||||||
return dict(foo=42)
|
return dict(foo=42)
|
||||||
|
|
||||||
rv = flask.render_template_string("Hello {{ config.WORLD_NAME }} " "{{ foo }}")
|
rv = flask.render_template_string("Hello {{ config.WORLD_NAME }} {{ foo }}")
|
||||||
assert rv == "Hello Special World 42"
|
assert rv == "Hello Special World 42"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue