def refresh(self): # Get list of templates if modified file_list = utils.list_dir_if_changed(self.project.templates_root, self.last_modified, ["htm", "html"]) if file_list: self[:] = [Template(file_name, self.project) for file_name in file_list[0]] self.last_modified = file_list[1] logger.debug('Reloaded template list for project %s' % self.project.name)
def refresh(self): if os.path.isdir(self.project.data_root): file_list = utils.list_dir_if_changed(self.project.data_root, self.last_modified) if file_list: self.clear() for file_name in file_list[0]: file_parts = file_name.split(".") with open(os.path.join(self.project.data_root, file_name)) as f: try: self[file_parts[0]] = json.load(f) except: self[file_parts[0]] = None self.last_modified = file_list[1] logger.debug('Reloaded data store for project %s' % self.project.name)