Example #1
0
def get_theme(slug):
    
    theme = None
    for theme_dir in settings.THEMES_DIRS:
        themes = ThemeStorage(location=theme_dir)
        directories, files = themes.listdir('./')
        for t in directories:
            if t == slug:
                theme = {'slug': t, 'path': themes.path(t)}
                break
    return theme
Example #2
0
def get_theme(slug):

    theme = None
    for theme_dir in settings.THEMES_DIRS:
        themes = ThemeStorage(location=theme_dir)
        directories, files = themes.listdir('./')
        for t in directories:
            if t == slug:
                theme = {'slug': t, 'path': themes.path(t)}
                break
    return theme
Example #3
0
    def __init__(self, apps=None, *args, **kwargs):
        self.locations = list(getattr(settings, 'THEMES_DIRS', []))

        # Maps dir paths to an appropriate storage instance
        self.storages = SortedDict()

        for root in self.locations:
            filesystem_storage = ThemeStorage(location=root)
            self.storages[root] = filesystem_storage

        super(StaticFinder, self).__init__(*args, **kwargs)
Example #4
0
def list_themes():
    ''' Return the list of availables themes
    >>> list_themes()
    [{'path': u'~/hg/ionyweb3/ionyweb/contrib/themes/jungleland', 'slug': u'jungleland'}]

    '''

    unique_slug = []
    themes_list = []
    for theme_dir in settings.THEMES_DIRS:
        themes = ThemeStorage(location=theme_dir)
        directories, files = themes.listdir('./')

        new_list = []
        for t in directories:
            if t not in unique_slug:
                new_list.append({'slug': t, 'path': themes.path(t)})
                unique_slug.append(t)
        themes_list += new_list

    return themes_list
Example #5
0
def list_themes():
    ''' Return the list of availables themes
    >>> list_themes()
    [{'path': u'~/hg/ionyweb3/ionyweb/contrib/themes/jungleland', 'slug': u'jungleland'}]

    '''

    unique_slug = []
    themes_list = []
    for theme_dir in settings.THEMES_DIRS:
        themes = ThemeStorage(location=theme_dir)
        directories, files = themes.listdir('./')

        new_list = []
        for t in directories:
            if t not in unique_slug:
                new_list.append({'slug': t, 'path': themes.path(t)})
                unique_slug.append(t)
        themes_list += new_list

    return themes_list