diff --git a/IntegrationTest.py b/IntegrationTest.py index c954b5be..7d429d14 100644 --- a/IntegrationTest.py +++ b/IntegrationTest.py @@ -15,6 +15,7 @@ def dumpUser( u ): print "<-", r.source.owner.login + "/" + r.source.name, print print " Watched:", ", ".join( r.name for r in u.get_watched() ) + print " Organizations:", ", ".join( o.login for o in u.get_orgs() ) print def dumpOrganization( o ): diff --git a/Reference.md b/Reference.md index 6391601f..4e57e874 100644 --- a/Reference.md +++ b/Reference.md @@ -424,7 +424,7 @@ /user/orgs ========== - - GET: `` (TODO) + - GET: `AuthenticatedUser.get_orgs()` : list of `Organization` /user/repos =========== @@ -471,7 +471,7 @@ /users/:user/orgs ================= - - GET: `` (TODO) + - GET: `NamedUser.get_orgs()` : list of `Organization` /users/:user/received_events ============================ diff --git a/github/GithubObject.py b/github/GithubObject.py index b503b87a..8dc267e9 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -9,6 +9,8 @@ class SimpleScalarAttributes: self.__attributeNames = attributeNames def getValueFromRawValue( self, obj, rawValue ): + # if isinstance( rawValue, dict ): + # print rawValue, "is a dict, you may want to use an extended attribute for it" return rawValue def updateAttributes( self, obj ): diff --git a/github/GithubObjects.py b/github/GithubObjects.py index 853e11d0..eca97b08 100644 --- a/github/GithubObjects.py +++ b/github/GithubObjects.py @@ -38,6 +38,9 @@ Organization = GithubObject( ExtendedListAttribute( "members", NamedUser ), ) +AuthenticatedUser._addAttributePolicy( ExtendedListAttribute( "orgs", Organization ) ) +NamedUser._addAttributePolicy( ExtendedListAttribute( "orgs", Organization ) ) + Repository = GithubObject( "Repository", BaseUrl( lambda obj: "/repos/" + obj.owner.login + "/" + obj.name ),