[kupfer] core: Recalculate SourceController.root on when catalog is updated



commit 8c3c2f9af2c17427018f1bcb3a22c8d4601adb45
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Thu Feb 4 00:21:28 2010 +0100

    core: Recalculate SourceController.root on when catalog is updated

 kupfer/core/sources.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/kupfer/core/sources.py b/kupfer/core/sources.py
index 095747e..da2a690 100644
--- a/kupfer/core/sources.py
+++ b/kupfer/core/sources.py
@@ -245,8 +245,10 @@ class SourceController (pretty.OutputMixin):
 		self.action_decorators = {}
 		self.loaded_successfully = False
 		self._restored_sources = set()
+		self._pre_root = None
 
 	def add(self, srcs, toplevel=False, initialize=False):
+		self._pre_root = None
 		sources = set(self._try_restore(srcs))
 		self._restored_sources.update(sources)
 		sources.update(srcs)
@@ -310,9 +312,8 @@ class SourceController (pretty.OutputMixin):
 
 	@property
 	def _firstlevel(self):
-		firstlevel = getattr(self, "_pre_root", None)
-		if firstlevel:
-			return firstlevel
+		if self._pre_root:
+			return self._pre_root
 		sourceindex = set(self.sources)
 		kupfer_sources = sources.SourcesSource(self.sources)
 		sourceindex.add(kupfer_sources)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]