def set(self, name, value): """Save configuration tuple to data store""" config_tuple = ConfigTuple.get_by_key_name(name) if not config_tuple: config_tuple = ConfigTuple(key_name=name) config_tuple.value = value config_tuple.put()
def get(self, name): """Get config tuple from data store; return default if no tuple is found""" config_value = ConfigTuple.get_or_insert(name, value=self.defaults[name]) return config_value.value