Esempio n. 1
0
def index(request):
    if request.method == 'GET':
        return render_to_response("hooks/index.html",
                {"main_active": "active"})
    elif request.method == 'POST':
        payload = request.POST["payload"]
        payload = urllib.unquote(payload)
        payload = simplejson.loads(payload)
        #logging.info("-"*40 + "\n" + pprint.pformat(payload) + "\n" + "-"*40)
        repository = payload["repository"]
        owner = repository["owner"]
        r, u = create_repository_and_owner(repository["name"],
                owner["name"], owner["email"])
        u = RepoUpdate(repo=r, update=pprint.pformat(payload))
        u.save()
        return HttpResponse("OK\n")
Esempio n. 2
0
def repo(request, repo):
    r = Repository.get(db.Key(repo))
    repo_url = "http://github.com/%s/%s" % (r.owner.name, r.name)
    updates = RepoUpdate.gql("WHERE repo = :1", r)
    authors = Author.gql("WHERE repo = :1", r)
    a = []
    for author in authors:
        u = author.user
        a.append({"name": u.name, "email": u.email, "key": u.key(),
            "gravatar_url": get_gravatar_url(u.email)})
    return render_to_response("hooks/repo.html", {'repo': r,
        'repo_url': repo_url, 'updates': updates, 'authors': a})