diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2009-08-13 20:42:22 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-08-18 12:10:35 (GMT) |
commit | b5f26bd4290e3fa78a46d1912bccedd2fb862d3b (patch) | |
tree | 36da91231891c28fc6a87c853a41fec84d739976 | |
parent | 22cf90c7a23fdf1687b6c4a75c64aa9c95d7c8a3 (diff) |
Upgrade activities that were installed from bundles #1176
-rw-r--r-- | src/jarabe/model/bundleregistry.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py index 351459b..a3dc3ea 100644 --- a/src/jarabe/model/bundleregistry.py +++ b/src/jarabe/model/bundleregistry.py @@ -307,6 +307,14 @@ class BundleRegistry(gobject.GObject): 'favorites': self._favorite_bundles} open(path, 'w').write(cjson.encode(favorites_data)) + def is_pre_installed(self, bundle_id): + installed = self.get_bundle(bundle_id) + if installed is not None and \ + not installed.get_path().startswith( + env.get_user_activities_path()): + return True + return False + def is_installed(self, bundle): # TODO treat ContentBundle in special way # needs rethinking while fixing ContentBundle support @@ -324,7 +332,8 @@ class BundleRegistry(gobject.GObject): def install(self, bundle): activities_path = env.get_user_activities_path() - if self.get_bundle(bundle.get_bundle_id()): + if self.is_pre_installed(bundle.get_bundle_id()) or \ + self.is_installed(bundle): raise AlreadyInstalledException for installed_bundle in self._bundles: |