|
|
|
@ -848,43 +848,56 @@ class locked_cached_property(object):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class _PackageBoundObject(object): |
|
|
|
|
#: The name of the package or module that this app belongs to. Do not |
|
|
|
|
#: change this once it is set by the constructor. |
|
|
|
|
import_name = None |
|
|
|
|
|
|
|
|
|
#: Location of the template files to be added to the template lookup. |
|
|
|
|
#: ``None`` if templates should not be added. |
|
|
|
|
template_folder = None |
|
|
|
|
|
|
|
|
|
#: Absolute path to the package on the filesystem. Used to look up |
|
|
|
|
#: resources contained in the package. |
|
|
|
|
root_path = None |
|
|
|
|
|
|
|
|
|
def __init__(self, import_name, template_folder=None, root_path=None): |
|
|
|
|
#: The name of the package or module. Do not change this once |
|
|
|
|
#: it was set by the constructor. |
|
|
|
|
self.import_name = import_name |
|
|
|
|
|
|
|
|
|
#: location of the templates. ``None`` if templates should not be |
|
|
|
|
#: exposed. |
|
|
|
|
self.template_folder = template_folder |
|
|
|
|
|
|
|
|
|
if root_path is None: |
|
|
|
|
root_path = get_root_path(self.import_name) |
|
|
|
|
|
|
|
|
|
#: Where is the app root located? |
|
|
|
|
self.root_path = root_path |
|
|
|
|
|
|
|
|
|
self._static_folder = None |
|
|
|
|
self._static_url_path = None |
|
|
|
|
|
|
|
|
|
def _get_static_folder(self): |
|
|
|
|
if self._static_folder is not None: |
|
|
|
|
return os.path.join(self.root_path, self._static_folder) |
|
|
|
|
|
|
|
|
|
def _set_static_folder(self, value): |
|
|
|
|
self._static_folder = value |
|
|
|
|
static_folder = property(_get_static_folder, _set_static_folder, doc=''' |
|
|
|
|
The absolute path to the configured static folder. |
|
|
|
|
''') |
|
|
|
|
|
|
|
|
|
static_folder = property( |
|
|
|
|
_get_static_folder, _set_static_folder, |
|
|
|
|
doc='The absolute path to the configured static folder.' |
|
|
|
|
) |
|
|
|
|
del _get_static_folder, _set_static_folder |
|
|
|
|
|
|
|
|
|
def _get_static_url_path(self): |
|
|
|
|
if self._static_url_path is not None: |
|
|
|
|
return self._static_url_path |
|
|
|
|
|
|
|
|
|
if self.static_folder is not None: |
|
|
|
|
return '/' + os.path.basename(self.static_folder) |
|
|
|
|
|
|
|
|
|
def _set_static_url_path(self, value): |
|
|
|
|
self._static_url_path = value |
|
|
|
|
static_url_path = property(_get_static_url_path, _set_static_url_path) |
|
|
|
|
|
|
|
|
|
static_url_path = property( |
|
|
|
|
_get_static_url_path, _set_static_url_path, |
|
|
|
|
doc='The URL prefix that the static route will be registered for.' |
|
|
|
|
) |
|
|
|
|
del _get_static_url_path, _set_static_url_path |
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|