def read_meta(path): """ :param path: path for the theme. :return: Theme meta read in path. """ if not os.path.exists(path): return meta = os.path.join(path, 'theme.py') if not os.path.exists(meta): logging.warn("%s is not a catsup theme." % path) return theme = ObjectDict( name='', author='', homepage='', pages=[], has_index=False, path=path, vars={}, ) execfile(meta, {}, theme) templates_path = os.path.join(path, 'templates') for page in theme.pages: if page == 'page.html': theme.has_index = True # If your theme does not have index page, # catsup will rename page/1.html to page.html. if not os.path.exists(os.path.join(templates_path, page)): logging.warning("%s announces a page %s" " which not exists." % (theme.name, page)) theme.name = theme.name.lower() return theme