On the way to remove modifyAttributes from ElementCreatable and ListGetable

This commit is contained in:
Vincent Jacques
2012-02-26 10:29:59 +00:00
parent f5e9a55ed1
commit b9a0ba9ade
2 changed files with 8 additions and 5 deletions
+6 -4
View File
@@ -133,6 +133,8 @@ Label = GithubObject(
Deletable(),
)
__modifyAttributesForObjectsReferingReferedRepo = lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) )
Milestone = GithubObject(
"Milestone",
BaseUrl( lambda obj: obj._repo._baseUrl + "/milestones/" + str( obj.number ) ),
@@ -144,7 +146,7 @@ Milestone = GithubObject(
InternalObjectAttribute( "creator", NamedUser ),
Editable( [ "title" ], [ "state", "description", "due_on" ] ),
Deletable(),
ExternalListOfObjects( "labels", "label", Label, ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ) ),
ExternalListOfObjects( "labels", "label", Label, ListGetable( [], [], __modifyAttributesForObjectsReferingReferedRepo ) ),
)
IssueComment = GithubObject(
@@ -173,16 +175,16 @@ Issue = GithubObject(
InternalObjectAttribute( "milestone", Milestone ),
Editable( [], [ "title", "body", "assignee", "state", "milestone", "labels" ] ),
ExternalListOfObjects( "labels", "label", Label,
ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ),
ListGetable( [], [], __modifyAttributesForObjectsReferingReferedRepo ),
SeveralElementsAddable(),
ListSetable(),
ListDeletable(),
ElementRemovable(),
),
ExternalListOfObjects( "comments", "comment", IssueComment,
ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ),
ListGetable( [], [], __modifyAttributesForObjectsReferingReferedRepo ),
ElementGetable( [ "id" ], [], "_repo" ),
ElementCreatable( [ "body" ], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ),
ElementCreatable( [ "body" ], [], __modifyAttributesForObjectsReferingReferedRepo ),
),
)