File tree Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -62,20 +62,19 @@ def __init__(self, path=None):
6262
6363 self .git = Git (self .wd )
6464
65- @property
66- def description (self ):
67- """
68- The project's description. Taken verbatim from GIT_REPO/description
69-
70- Returns
71- str
72- """
73- try :
74- f = open (os .path .join (self .path , 'description' ))
75- result = f .read ()
76- return result .rstrip ()
77- finally :
78- f .close ()
65+ # Description property
66+ def _get_description (self ):
67+ filename = os .path .join (self .path , 'description' )
68+ return file (filename ).read ().rstrip ()
69+
70+ def _set_description (self , descr ):
71+ filename = os .path .join (self .path , 'description' )
72+ file (filename , 'w' ).write (descr + '\n ' )
73+
74+ description = property (_get_description , _set_description ,
75+ doc = "the project's description" )
76+ del _get_description
77+ del _set_description
7978
8079 @property
8180 def heads (self ):
Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ def test_new_should_raise_on_non_existant_path(self):
2525 Repo ("repos/foobar" )
2626
2727 def test_description (self ):
28- assert_equal ("Unnamed repository; edit this file to name it for gitweb." , self .repo .description )
28+ txt = "Test repository"
29+ self .repo .description = txt
30+ assert_equal (self .repo .description , txt )
2931
3032 def test_heads_should_return_array_of_head_objects (self ):
3133 for head in self .repo .heads :
You can’t perform that action at this time.
0 commit comments