diff options
Diffstat (limited to 'sugar/activity/bundle.py')
-rw-r--r-- | sugar/activity/bundle.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sugar/activity/bundle.py b/sugar/activity/bundle.py index a9c246d..d361c62 100644 --- a/sugar/activity/bundle.py +++ b/sugar/activity/bundle.py @@ -41,6 +41,7 @@ class NotInstalledException(Exception): pass class InvalidPathException(Exception): pass class ZipExtractException(Exception): pass class RegistrationException(Exception): pass +class MalformedBundleException(Exception): pass class Bundle: """Metadata description of a given application/activity @@ -265,10 +266,12 @@ class Bundle: if not bundle_root_dir: bundle_root_dir = file_name.split('/')[0] if not bundle_root_dir.endswith('.activity'): - raise 'Incorrect bundle.' + raise MalformedBundleException( + 'The activity directory name must end with .activity') else: if not file_name.startswith(bundle_root_dir): - raise 'Incorrect bundle.' + raise MalformedBundleException( + 'All files in the bundle must be inside the activity directory') return bundle_root_dir @@ -293,11 +296,8 @@ class Bundle: raise ZipExtractException self._init_with_path(bundle_path) - - bus = dbus.SessionBus() - proxy_obj = bus.get_object(_DBUS_SHELL_SERVICE, _DBUS_SHELL_PATH) - dbus_service = dbus.Interface(proxy_obj, _DBUS_ACTIVITY_REGISTRY_IFACE) - if not dbus_service.AddBundle(bundle_path): + + if not activity.get_registry().add_bundle(bundle_path): raise RegistrationException def deinstall(self): |