Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

dropped pkg_resources

  • Loading branch information...
commit fedc06c2950a4c9930082a014d0f8da6ee0193be 1 parent 532347d
@mitsuhiko authored
Showing with 5 additions and 21 deletions.
  1. +2 −0  CHANGES
  2. +2 −4 flask/app.py
  3. +1 −17 flask/helpers.py
View
2  CHANGES
@@ -19,6 +19,8 @@ Codename to be decided, release date to be announced.
single file.
- :func:`flask.send_file` now emits etags and has the ability to
do conditional responses builtin.
+- (temporarily) dropped support for zipped applications. This was a
+ rarely used feature and led to some confusing behaviour.
Version 0.4
-----------
View
6 flask/app.py
@@ -21,7 +21,7 @@
from werkzeug.exceptions import HTTPException, InternalServerError, NotFound
from flask.helpers import _PackageBoundObject, url_for, get_flashed_messages, \
- _tojson_filter, get_pkg_resources, send_file
+ _tojson_filter, send_file
from flask.wrappers import Request, Response
from flask.config import ConfigAttribute, Config
from flask.ctx import _default_template_ctx_processor, _RequestContext
@@ -319,9 +319,7 @@ def create_jinja_loader(self):
`templates` folder. To add other loaders it's possible to
override this method.
"""
- if get_pkg_resources() is None:
- return FileSystemLoader(os.path.join(self.root_path, 'templates'))
- return PackageLoader(self.import_name)
+ return FileSystemLoader(os.path.join(self.root_path, 'templates'))
def init_jinja_globals(self):
"""Called directly after the environment was created to inject
View
18 flask/helpers.py
@@ -82,19 +82,6 @@ def get_current_user():
indent=None if request.is_xhr else 2), mimetype='application/json')
-def get_pkg_resources():
- """Use pkg_resource if that works, otherwise fall back to cwd. The
- current working directory is generally not reliable with the notable
- exception of google appengine.
- """
- try:
- import pkg_resources
- pkg_resources.resource_stream
- except (ImportError, AttributeError):
- return
- return pkg_resources
-
-
def url_for(endpoint, **values):
"""Generates a URL to the given endpoint with the method provided.
The endpoint is relative to the active module if modules are in use.
@@ -365,7 +352,4 @@ def open_resource(self, resource):
:param resource: the name of the resource. To access resources within
subfolders use forward slashes as separator.
"""
- pkg_resources = get_pkg_resources()
- if pkg_resources is None:
- return open(os.path.join(self.root_path, resource), 'rb')
- return pkg_resources.resource_stream(self.import_name, resource)
+ return open(os.path.join(self.root_path, resource), 'rb')
Please sign in to comment.
Something went wrong with that request. Please try again.