This commit is contained in:
Vincent Jacques
2012-02-24 11:46:34 +00:00
parent eac514210e
commit d5202efc25
4 changed files with 34 additions and 5 deletions
+17
View File
@@ -1,4 +1,5 @@
import itertools
import urllib
from GithubObject import *
@@ -115,6 +116,17 @@ GitTag = GithubObject(
),
)
Label = GithubObject(
"Label",
BaseUrl( lambda obj: obj._repo._baseUrl + "/labels/" + urllib.quote( obj.name ) ),
BasicAttributes(
"url", "name", "color",
"_repo", ### Ugly hack
),
Editable( [ "name", "color" ], [] ),
Deletable(),
)
Milestone = GithubObject(
"Milestone",
BaseUrl( lambda obj: obj._repo._baseUrl + "/milestones/" + str( obj.number ) ),
@@ -168,6 +180,11 @@ Repository = GithubObject(
ElementGetable( "git_tag", lambda repo, sha: { "_repo": repo, "sha": sha } ),
ElementCreatable( "git_tag", [ "tag", "message", "object", "type" ], [ "tagger" ], __modifyAttributesForObjectsReferingRepo )
),
ListAttribute( "labels", Label,
ListGetable( [], [] ),
ElementGetable( "label", lambda repo, name: { "_repo": repo, "name": name } ),
ElementCreatable( "label", [ "name", "color" ], [], __modifyAttributesForObjectsReferingRepo ),
),
ListAttribute( "milestones", Milestone,
ListGetable( [], [ "state", "sort", "direction" ] ),
ElementGetable( "milestone", lambda repo, number: { "_repo": repo, "number": number } ),