Skip to content
Myr

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

3 files+5 added−21 removed

modified:flask/app.py+2 added-4 removed
19 unmodified lines
20from werkzeug.routing import Map, Rule21from werkzeug.exceptions import HTTPException, InternalServerError, NotFound2223from flask.helpers import _PackageBoundObject, url_for, get_flashed_messages, \24 _tojson_filter, get_pkg_resources, send_file24 _tojson_filter, send_file25from flask.wrappers import Request, Response26from flask.config import ConfigAttribute, Config27from flask.ctx import _default_template_ctx_processor, _RequestContext28from flask.globals import _request_ctx_stack, request
289 unmodified lines
318 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)323324 def init_jinja_globals(self):325 """Called directly after the environment was created to inject326 some defaults (like `url_for`, `get_flashed_messages` and the
517 unmodified lines
modified:flask/helpers.py+1 added-17 removed
80 unmodified lines
81 return current_app.response_class(json.dumps(dict(*args, **kwargs),82 indent=None if request.is_xhr else 2), mimetype='application/json')838485def 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_resources969785def 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 lines
351352 :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 lines
18- 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.2425Version 0.426-----------27
66 unmodified lines