Пример #1
0
 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)
Пример #2
0
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))
Пример #3
0
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))
Пример #4
0
 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)
Пример #5
0
 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)