def save(self, values): for e in self.items.values(): if e.type == 'boolean': e.value = values.get(e.name, "0") elif e.type == 'text': e.value = values.get(e.name, "") item = ProjectSetting.all().ancestor(self.project).\ filter("name =", self.name).\ filter("item_name =", e.name).get() if item is None: item = ProjectSetting(parent=self.project, name=self.name, item_name=e.name, ) item.item_value = e.value item.put() self.db[item.item_name] = item.item_value
def __load_db(self, ): for e in ProjectSetting.all().ancestor(self.project).\ filter("name =", self.name): self.db[e.item_name] = e.item_value