RepositoryKey: first step

This commit is contained in:
Vincent Jacques
2012-03-01 17:45:50 +01:00
parent f02c938974
commit 2ea7ce7723
3 changed files with 41 additions and 5 deletions
+16
View File
@@ -368,6 +368,17 @@ PullRequest = GithubObject(
),
)
RepositoryKey = GithubObject(
"RepositoryKey",
BaseUrl( lambda obj: obj._repo._baseUrl + "/keys/" + str( obj.id ) ),
InternalSimpleAttributes(
### @todo
"_repo", ### Ugly hack
),
Editable( [], [] ), ### @todo
Deletable()
)
Repository = GithubObject(
"Repository",
BaseUrl( lambda obj: "/repos/" + obj.owner.login + "/" + obj.name ),
@@ -397,6 +408,11 @@ Repository._addAttributePolicy(
SeveralAttributePolicies( [ ExternalSimpleAttribute( "languages", "dictionary of strings to integers" ) ], "Languages" )
)
Repository._addAttributePolicy( SeveralAttributePolicies( [
ExternalListOfObjects( "keys", "key", RepositoryKey,
ListGetable( [], [] ),
ElementGetable( [ "id" ], [], __modifyAttributesForObjectsReferingRepo ),
ElementCreatable( [], [] ), ### @todo
),
ExternalListOfObjects( "collaborators", "collaborator", NamedUser,
ListGetable( [], [] ),
ElementAddable(),