From 4a5cf98e7f959f1b5d9af484760c25cd27d9180d Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Tue, 13 Mar 2012 19:37:23 +0100 Subject: [PATCH] Spliting GithubObjects.py --- github/AuthenticatedUser.py | 8 ++++++++ github/GithubObjects.py | 10 ---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/github/AuthenticatedUser.py b/github/AuthenticatedUser.py index c97af4a9..c7762ed1 100644 --- a/github/AuthenticatedUser.py +++ b/github/AuthenticatedUser.py @@ -6,6 +6,13 @@ from Event import Event from NamedUser import NamedUser from Organization import Organization +def __getOrganizationEvents( user, org ): + return [ + Event( user._github, attributes, lazy = True ) + for attributes + in user._github._dataRequest( "GET", "/users/" + user.login + "/events/orgs/" + org.login, None, None ) + ] + AuthenticatedUser = GithubObject( "AuthenticatedUser", BaseUrl( lambda obj: "/user" ), @@ -50,4 +57,5 @@ AuthenticatedUser = GithubObject( ExternalListOfObjects( "orgs", "org", Organization, ListGetable( [], [] ) ), + MethodFromCallable( "get_organization_events", [ "org" ], [], __getOrganizationEvents, SimpleTypePolicy( "list of `Event`" ) ), ) diff --git a/github/GithubObjects.py b/github/GithubObjects.py index 4cbe9c59..4f434edc 100644 --- a/github/GithubObjects.py +++ b/github/GithubObjects.py @@ -16,16 +16,6 @@ NamedUser._addAttributePolicy( ) ) -def __getOrganizationEvents( user, org ): - return [ - Event( user._github, attributes, lazy = True ) - for attributes - in user._github._dataRequest( "GET", "/users/" + user.login + "/events/orgs/" + org.login, None, None ) - ] -AuthenticatedUser._addAttributePolicy( - MethodFromCallable( "get_organization_events", [ "org" ], [], __getOrganizationEvents, SimpleTypePolicy( "list of `Event`" ) ) -) - GitRef = GithubObject( "GitRef", BaseUrl( lambda obj: obj._repo._baseUrl() + "/git/" + obj.ref ),