Skip to content
Myr

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

2 files+30 added−31 removed

modified:flask/app.py+30 added-18 removed
347 unmodified lines
348 #: Absolute path to the package on the filesystem. Used to look up349 #: resources contained in the package.350 root_path = None351352 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 )370371 if static_url_path is not None:372 self.static_url_path = static_url_path373374 if static_folder is not None:375 self.static_folder = static_folder376377 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 )384385 #: Holds the path to the instance folder.386 #:387 #: .. versionadded:: 0.8
167 unmodified lines
555 # 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 )565566 #: 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 are
1615 unmodified lines
modified:tests/test_basic.py-13 removed
1351 unmodified lines
1352 '/static/index.html'1353 rv.close()135413551356def test_static_path_deprecated(recwarn):1357 app = flask.Flask(__name__, static_path='/foo')1358 recwarn.pop(DeprecationWarning)13591360 app.testing = True1361 rv = app.test_client().get('/foo/index.html')1362 assert rv.status_code == 2001363 rv.close()13641365 with app.test_request_context():1366 assert flask.url_for('static', filename='index.html') == '/foo/index.html'136713681356def 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