Remove complete-ability from git objects

This commit is contained in:
Vincent Jacques
2012-05-12 14:14:31 +02:00
parent 8956796e7f
commit 71b0ede8de
8 changed files with 6 additions and 135 deletions
-19
View File
@@ -14,22 +14,17 @@ class GitObject( object ):
self.__completed = False
self.__initAttributes()
self.__useAttributes( attributes )
if not lazy:
self.__complete()
@property
def sha( self ):
self.__completeIfNeeded( self.__sha )
return self.__sha
@property
def type( self ):
self.__completeIfNeeded( self.__type )
return self.__type
@property
def url( self ):
self.__completeIfNeeded( self.__url )
return self.__url
def __initAttributes( self ):
@@ -37,20 +32,6 @@ class GitObject( object ):
self.__type = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
def __complete( self ):
status, headers, data = self.__requester.request(
"GET",
self.__url,
None,
None
)
self.__useAttributes( data )
self.__completed = True
def __useAttributes( self, attributes ):
# @todo Remove this debug weakness: we shall assume that github will add new attributes
for attribute in attributes: