def themes_info(slug=None):
    ''' Loads the MANIFEST for each available theme
    >>> themes_info()
    {u'natim': {'preview': '/_static/themes/icon-themes.png', 'title': u'natim'}, 
     u'jungleland': {'website': u'http://www.styleshout.com/', 'description': u'...', 
                     'title': u'Jungle Land', 'author': u'styleshout', 'date': u'01/09/2009', 
                     'preview': u'/_static/themes/jungleland/jungleland.jpg'}}
    '''
    # Get theme with slug or all themes list
    themes = []
    if slug is not None:
        theme_slug = get_theme(slug)
        if theme_slug:
            themes = [theme_slug]
        else:
            return None
    if not themes:
        themes = list_themes()

    themes_list = []
    for theme in themes:
        current_theme = {'slug': theme['slug'],
                         'title': theme['slug'].capitalize(),
                         'preview': ['%sthemes/icon-themes.png' % settings.STATIC_URL]}
        try:
            manifest_file = os.path.join(theme['path'], 'MANIFEST.json')
            with open(manifest_file, 'r') as f:
                try:
                    manifest = simplejson.loads(f.read())
                    # Set infos about preview files
                    if 'preview' in manifest.keys():
                        if isinstance(manifest['preview'], unicode) or isinstance(manifest['preview'], str):
                            previews = [manifest['preview']]
                        else:
                            previews = list(manifest['preview'])
                        manifest['preview'] = []
                        for preview in previews:
                            manifest['preview'].append(os.path.join(settings.STATIC_URL,
                                                                    settings.THEMES_DEFAULT_PATH,
                                                                    theme['slug'],
                                                                    preview))
                            
                    # set correct Path for each style        
                    if 'styles' in manifest.keys():  
                        for i in xrange(len(manifest['styles'])):
                            manifest['styles'][i]['preview'] = os.path.join(settings.STATIC_URL,
                                                               settings.THEMES_DEFAULT_PATH,
                                                               theme['slug'],
                                                               manifest['styles'][i]['preview'])
                        
                              
                    # Set infos about templates files
                    if 'templates' in manifest.keys():
                        templates_list = manifest['templates']
                        for template in templates_list:
                            template['preview'] = os.path.join(settings.STATIC_URL,
                                                               settings.THEMES_DEFAULT_PATH,
                                                               theme['slug'],
                                                               template['preview'])
                except ValueError as e:
                    sys.stderr.write('JSON syntax error in %s\n%s\n\n' % (manifest_file, str(e)))
                    continue

                current_theme.update(**manifest)
        except __HOLE__:
            pass
        themes_list.append(current_theme)

    return themes_list
dataset/ETHPy150Open ionyse/ionyweb/ionyweb/loaders/manifest.py/themes_info