def post(self, hunt_key_str): title = self.request.get('title') text_clue = self.request.get('text_clue') hunt = ndb.Key(urlsafe=urllib.unquote(hunt_key_str)).get() if hunt is not None and hunt.is_of_class_name('THHunt'): try: checkpoint = THCheckpoint(hunt=hunt.key, title=title, text_clue=text_clue) checkpoint.put() self.respond(checkpoint.as_dict()) except Exception, e: logging.error('Error creating checkpoint for hunt %s: %s' % (hunt_key_str, e.message)) raise
def checkpoints_keys(self): from th_models.th_checkpoint import THCheckpoint return THCheckpoint.query(THCheckpoint.hunt == self.key).fetch(keys_only=True)