[Dextrose] [PATCH] Copy .xo to removable device hack

Aleksey Lim alsroot at activitycentral.org
Wed Mar 16 07:43:38 EDT 2011


On Tue, Mar 15, 2011 at 10:12:23PM -0300, Martin Abente wrote:
> Plan Ceibal folks reported that it wasn't possible
> to copy .xo files from datastore to removable
> devices. This bug affects all versions of dextrose
> and other distros bases on sugar 0.88.1.
> 
> The problem was caused by a too generalist logic
> at _model_created_cb in which the journal was trying
> to install bundles also when copying files to
> external devices.
> 
> This bug seems to be fixed in mainstream, but as side
> effect of a big change to the journal code.
> 
> This patch checks for corner cases and avoid any attempt
> of installation when copying to external remoable devices.

+1

But would be useful to move _is_datastore_object() code to
_check_for_bundle() to suppress any issues if this code that will be
changed later in dextrose. Also would be useful to add XXX tag to not forget
tmp nature of this fix if `git annotate` is messy.

> Signed-off-by: Martin Abente <martin.abente.lahaye at gmail.com>
> ---
>  src/jarabe/journal/journalactivity.py |   17 ++++++++++++++---
>  1 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py
> index b96135c..456a027 100644
> --- a/src/jarabe/journal/journalactivity.py
> +++ b/src/jarabe/journal/journalactivity.py
> @@ -253,16 +253,27 @@ class JournalActivity(JournalWindow):
>          self._main_toolbox.search_toolbar.set_mount_point(mount_point)
>          self._main_toolbox.set_current_toolbar(0)
>  
> +    def _is_datastore_object(self, object_id):
> +        metadata = model.get(object_id)
> +        return model.is_editable(metadata)
> +
>      def __model_created_cb(self, sender, **kwargs):
> -        self._check_for_bundle(kwargs['object_id'])
> +        object_id = kwargs['object_id']
> +
> +        if self._is_datastore_object(object_id):
> +            self._check_for_bundle(object_id)
> +
>          self._main_toolbox.search_toolbar.refresh_filters()
>          self._check_available_space()
>  
>      def __model_updated_cb(self, sender, **kwargs):
> -        self._check_for_bundle(kwargs['object_id'])
> +        object_id = kwargs['object_id']
> +
> +        if self._is_datastore_object(object_id):
> +            self._check_for_bundle(object_id)
>  
>          if self.canvas == self._secondary_view and \
> -                kwargs['object_id'] == self._detail_view.props.metadata['uid']:
> +                object_id == self._detail_view.props.metadata['uid']:
>              self._detail_view.refresh()
>  
>          self._check_available_space()
> -- 
> 1.7.1
> 
> 

-- 
Aleksey


More information about the Dextrose mailing list