def post(self): user = users.GetCurrentUser() # TODO: Validate user is owner of current cycle. cycle_id = self.request.get('id') cycle = db.get(db.Key.from_path(Cycle.kind(), cycle_id)) if not cycle: self.response.set_status(404, 'Cycle with id ' + cycle_id + ' not found.') return events_query = CalendarEvent.all(keys_only=True) events_query.ancestor(cycle) db.delete(events_query.run()) db.delete(cycle) logging.info('Deleted cycle with id ' + cycle_id)