Issue.xxx_labels

This commit is contained in:
Vincent Jacques
2012-02-24 15:46:21 +00:00
parent ce2135c961
commit a03a904692
7 changed files with 64 additions and 10 deletions
+9 -1
View File
@@ -118,7 +118,8 @@ GitTag = GithubObject(
Label = GithubObject(
"Label",
BaseUrl( lambda obj: obj._repo._baseUrl + "/labels/" + urllib.quote( obj.name ) ),
BaseUrl( lambda obj: obj._repo._baseUrl + "/labels/" + obj._identity ),
Identity( lambda obj: urllib.quote( obj.name ) ),
BasicAttributes(
"url", "name", "color",
"_repo", ### Ugly hack
@@ -154,6 +155,13 @@ Issue = GithubObject(
ComplexAttribute( "assignee", NamedUser ),
ComplexAttribute( "milestone", Milestone ),
Editable( [], [ "title", "body", "assignee", "state", "milestone", "labels" ] ),
ListAttribute( "labels", Label,
ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ),
ListAddable(),
ListSetable(),
ListDeletable(),
ElementRemovable(),
),
)
__modifyAttributesForObjectsReferingRepo = lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj }.iteritems() ) )