forked from orbit-oss/flask
Rename _get_package_path to get_root_path to avoid confusion
This commit is contained in:
parent
b3aaf6d5ca
commit
c3844d1102
1 changed files with 7 additions and 3 deletions
|
|
@ -466,8 +466,12 @@ def send_from_directory(directory, filename, **options):
|
||||||
return send_file(filename, conditional=True, **options)
|
return send_file(filename, conditional=True, **options)
|
||||||
|
|
||||||
|
|
||||||
def get_package_path(name):
|
def get_root_path(name):
|
||||||
"""Returns the path to a package or cwd if that cannot be found."""
|
"""Returns the path to a package or cwd if that cannot be found. This
|
||||||
|
returns the path of a package or the folder that contains a module.
|
||||||
|
|
||||||
|
Not to be confused with the package path returned by :func:`find_package`.
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
return os.path.abspath(os.path.dirname(sys.modules[name].__file__))
|
return os.path.abspath(os.path.dirname(sys.modules[name].__file__))
|
||||||
except (KeyError, AttributeError):
|
except (KeyError, AttributeError):
|
||||||
|
|
@ -549,7 +553,7 @@ class _PackageBoundObject(object):
|
||||||
self.template_folder = template_folder
|
self.template_folder = template_folder
|
||||||
|
|
||||||
#: Where is the app root located?
|
#: Where is the app root located?
|
||||||
self.root_path = get_package_path(self.import_name)
|
self.root_path = get_root_path(self.import_name)
|
||||||
|
|
||||||
self._static_folder = None
|
self._static_folder = None
|
||||||
self._static_url_path = None
|
self._static_url_path = None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue