コード例 #1
0
ファイル: entry_input.py プロジェクト: di/doneit
def github_post_commit():
    _id = request.query.id
    key = request.query.key
    if _id and key and doneit.get_by_id("projects", _id)["secret-key"] == key:
        for commit in json.loads(request.forms["payload"])["commits"]:
            author = commit["author"]["email"]
            try:
                task = dict()
                task["user_id"] = ObjectId(doneit.get_user_by_email(author)["_id"])
                task["project_id"] = ObjectId(_id)
                task["type"] = "done"
                task["comment"] = commit["message"]
                task["date"] = datetime.datetime.utcnow()
                doneit.log("Added commit from " + author)
                doneit.add_task(task)
            except:
                doneit.log("Unknown git commit author:" + author_email)
    else:
        doneit.log("Tried to add task from github but authorization failed")
コード例 #2
0
ファイル: entry_input.py プロジェクト: di/doneit
def task_input():
    request.forms["user_id"] = ObjectId(request.forms["user_id"])
    request.forms["project_id"] = ObjectId(request.forms["project_id"])
    request.forms["date"] = datetime.datetime.utcnow()
    _id = doneit.add_task(dict(request.forms))
    return {"status": "success", "_id": str(_id)}