def initialize(self, root, template=None, force=False): if not template: template = "default" root_folder = Folder(root) template_dir = root_folder.child_folder("templates", template) if not template_dir.exists: raise ValueError("Cannot find the specified template[%s]." % template_dir) if self.site_path.exists: files = os.listdir(self.site_path.path) PathUtil.filter_hidden_inplace(files) if len(files) and not force: raise ValueError("The site_path[%s] is not empty." % self.site_path) else: self.site_path.delete() self.site_path.make() self.site_path.copy_contents_of(template_dir)