diff options
author | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-03-01 13:47:56 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-03-01 13:47:56 (GMT) |
commit | 92049568b99517c390336d9ae24ce0b125d3fe36 (patch) | |
tree | 253bcb8c21895f599515f27ab144955e7aa8a621 /src/jarabe | |
parent | a6e67afc2cc50ca09ba7b8e7e63e214e35dbc64a (diff) |
Avoid reading the bundle twice #442
Diffstat (limited to 'src/jarabe')
-rw-r--r-- | src/jarabe/model/bundleregistry.py | 13 |
1 files changed, 4 insertions, 9 deletions
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 |