[Pkg-sugar-commit] [sugar-toolkit] 29/118: Fix ContentBundle bundle_id

Jonas Smedegaard dr at jones.dk
Thu Apr 16 18:49:36 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/0.84.10-1
in repository sugar-toolkit.

commit d2fba30d9addbeb02fa86c2f7a9e59f62f30485b
Author: Daniel Drake <dsd at laptop.org>
Date:   Thu Jul 9 12:41:05 2009 +0100

    Fix ContentBundle bundle_id
    
    Most content bundles use global_name as the ID-style thing, as suggested
    on the OLPC wiki. bundle_class seems undocumented and hence is not
    present in any of the content bundles I have here.
    
    Change get_bundle_id() to fall back on the global_name if no bundle_class
    is set. This fixes a complete sugar crash when installing the standard
    content bundles (it tried to send a None value over dbus).
---
 src/sugar/bundle/contentbundle.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/sugar/bundle/contentbundle.py b/src/sugar/bundle/contentbundle.py
index d00936a..2d19417 100644
--- a/src/sugar/bundle/contentbundle.py
+++ b/src/sugar/bundle/contentbundle.py
@@ -54,6 +54,7 @@ class ContentBundle(Bundle):
         self._library_version = None
         self._bundle_class = None
         self._activity_start = None
+        self._global_name = None
 
         info_file = self.get_file('library/library.info')
         if info_file is None:
@@ -126,6 +127,11 @@ class ContentBundle(Bundle):
             raise MalformedBundleException(
                 'Content bundle %s does not specify a category' % self._path)
 
+        if cp.has_option(section, 'global_name'):
+            self._global_name = cp.get(section, 'global_name')
+        else:
+            self._global_name = None
+
         if cp.has_option(section, 'category_icon'):
             self._category_icon = cp.get(section, 'category_icon')
         else:
@@ -151,6 +157,11 @@ class ContentBundle(Bundle):
         else:
             self._activity_start = 'index.html'
 
+        if self._bundle_class is None and self._global_name is None:
+            raise MalformedBundleException(
+                'Content bundle %s must specify either global_name or '
+                'bundle_class' % self._path)
+
     def get_name(self):
         return self._name
 
@@ -201,7 +212,10 @@ class ContentBundle(Bundle):
     # TODO treat ContentBundle in special way
     # needs rethinking while fixing ContentBundle support
     def get_bundle_id(self):
-        return self._bundle_class
+        if self._bundle_class is not None:
+            return self._bundle_class
+        else:
+            return self._global_name
 
     # TODO treat ContentBundle in special way
     # needs rethinking while fixing ContentBundle support

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-toolkit.git



More information about the pkg-sugar-commit mailing list