Skip to content

Commit c595cf6

Browse files
committed
Add project property to Repository, a bit more convenient in client code than owner+'/'+name.
1 parent 9c573fa commit c595cf6

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

github2/repositories.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from github2.core import BaseData, GithubCommand, Attribute, DateAttribute
22

3-
43
class Repository(BaseData):
54
name = Attribute("Name of repository.")
65
description = Attribute("Repository description.")
@@ -18,8 +17,12 @@ class Repository(BaseData):
1817
has_wiki = Attribute("If True, this repository has a wiki.")
1918
has_issues = Attribute("If True, this repository has an issue tracker.")
2019

20+
def _project(self):
21+
return self.owner + "/" + self.name
22+
project = property(_project)
23+
2124
def __repr__(self):
22-
return "<Repository: %s/%s>" % (self.owner, self.name)
25+
return "<Repository: %s>" % (self._project())
2326

2427

2528
class Repositories(GithubCommand):

0 commit comments

Comments
 (0)