[Sugar-devel] Just wondering

James Cameron quozl at laptop.org
Sun Dec 21 15:24:17 EST 2014


On Sun, Dec 21, 2014 at 08:36:00AM +1100, Sam P. wrote:
> I have submitted a new patch which work both inside sugar and in
> other environments.
> 
> Please review:  [1]https://github.com/sugarlabs/sugar/pull/454

Looks good, but haven't looked at it relative to the original.

Comments:

1.  is SUGAR_PROFILE a correct environment variable to use?  The
exception posted by Martin was for SUGAR_MIME_DEFAULTS.

2.  patch description doesn't say anything about checking for an
environment variable,

3.  comment "signals are sent to the activity list" doesn't say why
these signals are useful,

4.  a more general design that uses exception handling rather than
pre-checking, is to change the check for SUGAR_PROFILE to a try except
clause:

bundle = ActivityBundle(sys.argv[1])
try:
    from jarabe.model.bundleregistry import get_registry
    registry = get_registry()
except KeyError: # sugar might not be running
    registry = None

if registry:
    registry.install(bundle, force_downgrade=True)
else:
    bundle.install()

5.  an overall design question; why are there two methods for
installing a bundle?  Can the bundle install method be changed to
accept a completion callback instead?  Can the registry class be
changed to accept a "bundle was installed" method instead?

-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list