remove deprecated Flask.static_path
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parent 9491bf8 · Browse files · 2 files·+30 added−31 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+30 added−31 removed
- tests:+0 added−13 removed
- other:+30 added−18 removed
Provenance
- Commit
d63c2bc- Tree
58835d3- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
9491bf8
2 files changed+30 added−31 removed
modified:flask/app.py+30 added-18 removed
347 unmodified lines348 #: Absolute path to the package on the filesystem. Used to look up349 #: resources contained in the package.350 root_path = None351 352- def __init__(self, import_name, static_path=None, static_url_path=None,353- static_folder='static', static_host=None,354- host_matching=False, template_folder='templates',355- instance_path=None, instance_relative_config=False,356- root_path=None):357- _PackageBoundObject.__init__(self, import_name,358- template_folder=template_folder,359- root_path=root_path)360- if static_path is not None:361- from warnings import warn362- warn(DeprecationWarning('static_path is now called '363- 'static_url_path'), stacklevel=2)364- static_url_path = static_path352+ def __init__(353+ self,354+ import_name,355+ static_url_path=None,356+ static_folder='static',357+ static_host=None,358+ host_matching=False,359+ template_folder='templates',360+ instance_path=None,361+ instance_relative_config=False,362+ root_path=None363+ ):364+ _PackageBoundObject.__init__(365+ self,366+ import_name,367+ template_folder=template_folder,368+ root_path=root_path369+ )370 371 if static_url_path is not None:372 self.static_url_path = static_url_path373+374 if static_folder is not None:375 self.static_folder = static_folder376+377 if instance_path is None:378 instance_path = self.auto_find_instance_path()379 elif not os.path.isabs(instance_path):373- raise ValueError('If an instance path is provided it must be '374- 'absolute. A relative path was given instead.')380+ raise ValueError(381+ 'If an instance path is provided it must be absolute.'382+ ' A relative path was given instead.'383+ )384 385 #: Holds the path to the instance folder.386 #:387 #: .. versionadded:: 0.8167 unmodified lines555 # For one, it might be created while the server is running (e.g. during556 # development). Also, Google App Engine stores static files somewhere557 if self.has_static_folder:558 assert bool(static_host) == host_matching, 'Invalid static_host/host_matching combination'550- self.add_url_rule(self.static_url_path + '/<path:filename>',551- endpoint='static', host=static_host,552- view_func=self.send_static_file)559+ self.add_url_rule(560+ self.static_url_path + '/<path:filename>',561+ endpoint='static',562+ host=static_host,563+ view_func=self.send_static_file564+ )565 566 #: The click command line context for this application. Commands567 #: registered here show up in the :command:`flask` command once the568 #: application has been discovered. The default commands are1615 unmodified linesmodified:tests/test_basic.py-13 removed
1351 unmodified lines1352 '/static/index.html'1353 rv.close()1354 1355 1356-def test_static_path_deprecated(recwarn):1357- app = flask.Flask(__name__, static_path='/foo')1358- recwarn.pop(DeprecationWarning)1359-1360- app.testing = True1361- rv = app.test_client().get('/foo/index.html')1362- assert rv.status_code == 2001363- rv.close()1364-1365- with app.test_request_context():1366- assert flask.url_for('static', filename='index.html') == '/foo/index.html'1367-1368-1356 def test_static_url_path():1357 app = flask.Flask(__name__, static_url_path='/foo')1358 app.testing = True1359 rv = app.test_client().get('/foo/index.html')493 unmodified lines