dropped pkg_resources
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 · parent 532347d · Browse files · 3 files·+5 added−21 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+5 added−21 removed
- other:+5 added−21 removed
Provenance
- Commit
fedc06c- Tree
caed87b- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
532347d
3 files changed+5 added−21 removed
modified:flask/app.py+2 added-4 removed
19 unmodified lines20 from werkzeug.routing import Map, Rule21 from werkzeug.exceptions import HTTPException, InternalServerError, NotFound22 23 from flask.helpers import _PackageBoundObject, url_for, get_flashed_messages, \24- _tojson_filter, get_pkg_resources, send_file24+ _tojson_filter, send_file25 from flask.wrappers import Request, Response26 from flask.config import ConfigAttribute, Config27 from flask.ctx import _default_template_ctx_processor, _RequestContext28 from flask.globals import _request_ctx_stack, request289 unmodified lines318 the configured package is returned that looks up templates in the319 `templates` folder. To add other loaders it's possible to320 override this method.321 """322- if get_pkg_resources() is None:323- return FileSystemLoader(os.path.join(self.root_path, 'templates'))322+ return FileSystemLoader(os.path.join(self.root_path, 'templates'))324- return PackageLoader(self.import_name)323 324 def init_jinja_globals(self):325 """Called directly after the environment was created to inject326 some defaults (like `url_for`, `get_flashed_messages` and the517 unmodified linesmodified:flask/helpers.py+1 added-17 removed
80 unmodified lines81 return current_app.response_class(json.dumps(dict(*args, **kwargs),82 indent=None if request.is_xhr else 2), mimetype='application/json')83 84 85-def get_pkg_resources():86- """Use pkg_resource if that works, otherwise fall back to cwd. The87- current working directory is generally not reliable with the notable88- exception of google appengine.89- """90- try:91- import pkg_resources92- pkg_resources.resource_stream93- except (ImportError, AttributeError):94- return95- return pkg_resources96-97-85 def url_for(endpoint, **values):86 """Generates a URL to the given endpoint with the method provided.87 The endpoint is relative to the active module if modules are in use.88 262 unmodified lines351 352 :param resource: the name of the resource. To access resources within353 subfolders use forward slashes as separator.354 """368- pkg_resources = get_pkg_resources()369- if pkg_resources is None:370- return open(os.path.join(self.root_path, resource), 'rb')355+ return open(os.path.join(self.root_path, resource), 'rb')371- return pkg_resources.resource_stream(self.import_name, resource)modified:CHANGES+2 added
17 unmodified lines18 - refactored Flask internally. It now consists of more than a19 single file.20 - :func:`flask.send_file` now emits etags and has the ability to21 do conditional responses builtin.22+- (temporarily) dropped support for zipped applications. This was a23+ rarely used feature and led to some confusing behaviour.24 25 Version 0.426 -----------27 66 unmodified lines