def delete_role(role_id): ''' delete a Role as long as it is not Present in a Place ''' if len(Presence.query(Presence.role == db.Key(urlsafe=role_id)).fetch()) > 0: raise ActionException('Role still has presence') db.Key(urlsafe=role_id).delete()
def _get_presences(place_id): place = db.Key(urlsafe=place_id) return [presence for presence in Presence.query(ancestor=place).fetch()]