diff --git a/github/Repository.py b/github/Repository.py index b60a3d18..a4676b06 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -997,7 +997,7 @@ class Repository(github.GithubObject.CompletableGithubObject): self.url + "/keys", input=post_parameters ) - return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True, repoUrl=self.url) + return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True) def create_label(self, name, color, description=github.GithubObject.NotSet): """ @@ -1883,7 +1883,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/keys/" + str(id) ) - return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True, repoUrl=self.url) + return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True) def get_keys(self): """ @@ -1891,7 +1891,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.RepositoryKey.RepositoryKey` """ return github.PaginatedList.PaginatedList( - lambda requester, headers, data, completed: github.RepositoryKey.RepositoryKey(requester, headers, data, completed, repoUrl=self.url), + github.RepositoryKey.RepositoryKey, self._requester, self.url + "/keys", None diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py index 7f38caba..2ef200a2 100644 --- a/github/RepositoryKey.py +++ b/github/RepositoryKey.py @@ -41,16 +41,8 @@ class RepositoryKey(github.GithubObject.CompletableGithubObject): This class represents RepositoryKeys. The reference can be found here http://developer.github.com/v3/repos/keys/ """ - def __init__(self, requester, headers, attributes, completed, repoUrl): - github.GithubObject.CompletableGithubObject.__init__(self, requester, headers, attributes, completed) - self.__repoUrl = repoUrl - def __repr__(self): - return self.get__repr__({"id": self._id.value}) - - @property - def __customUrl(self): - return self.__repoUrl + "/keys/" + str(self.id) + return self.get__repr__({"id": self._id.value, "title": self._title.value}) @property def created_at(self): @@ -115,7 +107,7 @@ class RepositoryKey(github.GithubObject.CompletableGithubObject): """ headers, data = self._requester.requestJsonAndCheck( "DELETE", - self.__customUrl + self.url ) def _initAttributes(self): diff --git a/github/tests/RepositoryKey.py b/github/tests/RepositoryKey.py index d6573f4a..ebe4ee76 100644 --- a/github/tests/RepositoryKey.py +++ b/github/tests/RepositoryKey.py @@ -50,7 +50,7 @@ class RepositoryKey(Framework.TestCase): self.assertTrue(self.key.verified) # test __repr__() based on this attributes - self.assertEqual(self.key.__repr__(), 'RepositoryKey(id=21870881)') + self.assertEqual(self.key.__repr__(), 'RepositoryKey(title="PyGithub Test Key", id=21870881)') def testDelete(self): self.key.delete()