コード例 #1
0
ファイル: toolkit.py プロジェクト: samlex20/ckan
    def _add_public_directory(cls, config, relative_path):
        '''Add a path to the :ref:`extra_public_paths` config setting.

        The path is relative to the file calling this function.

        Webassets addition: append directory to webassets load paths
        in order to correctly rewrite relative css paths and resolve
        public urls.

        '''
        import ckan.lib.helpers as h
        from ckan.lib.webassets_tools import add_public_path
        path = cls._add_served_directory(config, relative_path,
                                         'extra_public_paths')
        url = h._local_url('/', locale='default')
        add_public_path(path, url)
コード例 #2
0
def add_public_directory(config_: CKANConfig, relative_path: str):
    """Add a path to the :ref:`extra_public_paths` config setting.

    The path is relative to the file calling this function.

    Webassets addition: append directory to webassets load paths
    in order to correctly rewrite relative css paths and resolve
    public urls.

    """
    from ckan.lib.helpers import _local_url
    from ckan.lib.webassets_tools import add_public_path

    path = _add_served_directory(config_, relative_path, "extra_public_paths")
    url = _local_url("/", locale="default")
    add_public_path(path, url)