Small refactoring on lazy completion

This commit is contained in:
Vincent Jacques
2012-05-03 22:06:13 +01:00
parent c1026def6b
commit 68329733db
31 changed files with 391 additions and 720 deletions
+3 -4
View File
@@ -12,8 +12,7 @@ class {{ class.name }}( object ):
{% for attribute in class.attributes %}
@property
def {{ attribute.name }}( self ):
if self.__{{ attribute.name }} is None:
self.__completeIfNeeded()
self.__completeIfNeeded( self.__{{ attribute.name }} )
return self.__{{ attribute.name }}
{% endfor %}
@@ -22,8 +21,8 @@ class {{ class.name }}( object ):
self.__{{ attribute.name }} = None
{% endfor %}
def __completeIfNeeded( self ):
if not self.__completed:
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
self.__completed = True