@get('/kite/<user>/mail/<id>')
@with_valid_token
def index(user, id):
            try:
                threads_index = DatetimeCabinet("/home/kite/threads.db")
                thread = None
            except __HOLE__:
                response.status = 400
                return

            # FIXME: use an index for threads entries ?
            for thr in threads_index[user]["threads_index"]:
                if thr["id"] == id:
                    thread = thr

            if thread == None:
                abort(404, "Thread not found.")

            thread["unread"] = False
            threads_index.sync()

            response.content_type = "application/json"

            ret_json = {"messages": [], 
                        "subject": thread["subject"],
                        "date": thread["date"], 
                        "id": thread["id"]
            }

            mdir = read_mail("/home/kite/Maildirs/%s" % user)
            for mail_id in thread["messages"]:
                ret_json["messages"].append(get_email(mdir, mail_id)) 

            return serialize_json(ret_json, protection=False)
dataset/ETHPy150Open khamidou/kite/src/back/kite/server.py/index