Anonymous avatar Anonymous committed f37fdbc

project: using cacheit decorator for

Comments (0)

Files changed (1)


     def __init__(self, project):
         self.project = project
         self.needs_gc = True
-        self._observer = None
         self.files = set()
         self.folders = set()
             self.needs_gc = False
         return self.files
-    @property
-    def observer(self):
-        if self._observer is None:
-            self._init_observer()
-            self._update_folder(self.project.root)
-        return self._observer
     def _updated_resources(self, folder):
         if not folder.exists():
             return set(), set()
         self.needs_gc = True
-    def _init_observer(self):
-        self.rawobserver = ResourceObserver(
+    @property
+    @utils.cacheit
+    def observer(self):
+        rawobserver = ResourceObserver(
             self._changed, self._moved, self._created,
             self._removed, self._validate)
-        self._observer = FilteredResourceObserver(self.rawobserver)
-        self.project.add_observer(self._observer)
+        observer = FilteredResourceObserver(rawobserver)
+        self.project.add_observer(observer)
+        self._update_folder(self.project.root)
+        return observer
     def _changed(self, resource):
         if resource.is_folder():
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.