def _static_url_to_path(self, url): match = re.match(r'^static/assets/(core|plugin-(?P<plugin>[^/]+)|theme-(?P<theme>[^/]+))/(?P<path>.+)$', url) if match is not None: path = os.path.join(config.ASSETS_DIR, get_asset_path(**match.groupdict())) else: path = os.path.join(self._htdocs_dir, url) return re.sub(r'#.*$', '', path)
def static_asset(path, plugin=None, theme=None): # Ensure there's no weird stuff in the plugin/theme name if plugin and not plugin_engine.get_plugin(plugin): raise NotFound elif theme and theme not in theme_settings.themes: raise NotFound return send_from_directory(config.ASSETS_DIR, get_asset_path(path, plugin=plugin, theme=theme))
def _static_url_to_path(self, url): match = re.match( r'^static/assets/(core|plugin-(?P<plugin>[^/]+)|theme-(?P<theme>[^/]+))/(?P<path>.+)$', url) if match is not None: path = os.path.join(config.ASSETS_DIR, get_asset_path(**match.groupdict())) else: path = os.path.join(self._htdocs_dir, url) return re.sub(r'#.*$', '', path)
def _static_url_to_path(self, url): match = re.match( r'^static/assets/(core|plugin-(?P<plugin>[^/]+)|theme-(?P<theme>[^/]+))/(?P<path>.+)$', url) if match is not None: path = os.path.join(Config.getInstance().getAssetsDir(), get_asset_path(**match.groupdict())) else: path = os.path.join(Config.getInstance().getHtdocsDir(), url) return re.sub(r'#.*$', '', path)