From 92049568b99517c390336d9ae24ce0b125d3fe36 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Sun, 01 Mar 2009 13:47:56 +0000 Subject: Avoid reading the bundle twice #442 --- (limited to 'src') diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py index 62ac6e2..ee440a5 100644 --- a/src/jarabe/model/bundleregistry.py +++ b/src/jarabe/model/bundleregistry.py @@ -72,15 +72,7 @@ class BundleRegistry(gobject.GObject): if not one_file.get_path().endswith('.activity'): return if event_type == gio.FILE_MONITOR_EVENT_CREATED: - try: - bundle = ActivityBundle(one_file.get_path()) - except MalformedBundleException: - logging.error('Error loading bundle %r:\n%s' % ( - one_file.get_path(), - ''.join(traceback.format_exception(*sys.exc_info())))) - return - if not self.is_installed(bundle): - self.add_bundle(one_file.get_path()) + self.add_bundle(one_file.get_path()) elif event_type == gio.FILE_MONITOR_EVENT_DELETED: self.remove_bundle(one_file.get_path()) @@ -216,6 +208,9 @@ class BundleRegistry(gobject.GObject): ''.join(traceback.format_exception(*sys.exc_info())))) return None + if self.get_bundle(bundle.get_bundle_id()) is not None: + return None + self._bundles.append(bundle) return bundle -- cgit v0.9.1