def __init__(self, root, dest): self.root = root if op.exists(dest): shutil.rmtree(dest) self.settings = Settings(parent_tmpl='_base.html') conf = op.join(self.root, '.cyrax.cfg') if not op.exists(conf): conf = op.join(self.root, 'settings.cfg') if op.exists(conf): logger.warn('settings.cfg is deprecated, please rename to .cyrax.cfg') if op.exists(conf): self.settings.read(open(conf, 'rt').read()) site_base_path = base_path(self.url) self.dest = op.join(dest, url2path(site_base_path[1:])) self.env = initialize_env(root) self.env.globals['site'] = self self.entries = [] if self.settings.get('sitecallback'): callback = impcallback(self.settings.sitecallback, self.root) callback(self) self._traverse()
def __init__(self, root, dest): self.root = root if op.exists(dest): shutil.rmtree(dest) self.settings = Settings(parent_tmpl='_base.html') conf = op.join(self.root, 'settings.cfg') if op.exists(conf): self.settings.read(file(conf).read().decode('utf-8')) site_base_path = base_path(self.url) self.dest = op.join(dest, url2path(site_base_path[1:])) self.env = initialize_env(root) self.env.globals['site'] = self self.entries = [] if self.settings.get('sitecallback'): callback = impcallback(self.settings.sitecallback, self.root) callback(self) self._traverse()
def get_dest(self): path = op.join(self.site.dest, url2path(self.get_relative_url())) if self.isdir(): path = op.join(path, 'index.html') return path