def delete(self, tile_key): try: tile_data = redis_utils.get_redis_value(tile_key) except Exception: self.set_status(404) self.write('Cant find %s.\n' % tile_key) else: tile_data['meta'] = {} redis_utils.set_redis_value(tile_key, tile_data) self.write("Tile's config deleted.\n")
def post(self, tile_key): post_field = urlparse.parse_qs(self.request.body) validation_error = self.validate_post_request( post_field, ['value'], ) if validation_error: self.write(validation_error) return try: tile_data = redis_utils.get_redis_value(tile_key) except Exception: self.set_status(404) self.write("Can't find key %s.\n" % tile_key) return validation_error = self.validate_with_json(post_field['value'][0]) if validation_error: self.write(validation_error) return tile_data['meta'] = json.loads(post_field['value'][0]) redis_utils.set_redis_value(tile_key, tile_data) self.write("Tile's config updated.\n")