[Dextrose] [PATCH sugar] Do not send empty feedback reports if anonymous_with_sn is enabled

Anish Mangal anish at activitycentral.org
Mon Feb 14 22:02:38 EST 2011


On Fri, Feb 11, 2011 at 23:17, Aleksey Lim <alsroot at activitycentral.org> wrote:
> ---
>  src/jarabe/model/feedback_collector.py |   24 +++++++++++++-----------
>  1 files changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/src/jarabe/model/feedback_collector.py b/src/jarabe/model/feedback_collector.py
> index 43540a0..3f3b9a8 100644
> --- a/src/jarabe/model/feedback_collector.py
> +++ b/src/jarabe/model/feedback_collector.py
> @@ -49,7 +49,8 @@ def start(host, port, auto_submit_delay):
>     _port = port
>
>     if auto_submit_delay > 0:
> -        gobject.timeout_add_seconds(auto_submit_delay, anonymous_submit, True)
> +        logging.debug('Feedback auto submit with %ss delay', auto_submit_delay)
> +        gobject.timeout_add_seconds(auto_submit_delay, _auto_submit_cb)
>
>
>  def update(bundle_id, report, log_file):
> @@ -88,27 +89,28 @@ def submit(message):
>             'nick': nick,
>             'jabber_server': jabber,
>             }
> -    _submit(data, False)
> +    _reports.update(data)
> +    _submit(False)
>
>
>  def anonymous_submit(implicit=False):
> +    if is_empty():
> +        return
> +
>     from jarabe.journal import misc
>
> -    data = {}
>     client = gconf.client_get_default()
>     if client.get_bool('/desktop/sugar/feedback/anonymous_with_sn'):
> -        data['serial_number'] = misc.get_xo_serial()
> -    _submit(data, implicit)
> +        _reports['serial_number'] = misc.get_xo_serial()
> +    _submit(implicit)
>
> -    return True
>
> +def _auto_submit_cb():
> +    anonymous_submit()
> +    return True
>
> -def _submit(data, implicit):
> -    if data:
> -        _reports.update(data)
> -    if is_empty():
> -        return
>
> +def _submit(implicit):
>     logging.debug('Sending feedback report: %r', _reports)
>
>     report = simplejson.dumps(_reports)
> --
> 1.7.3.4
>
>

Committed to dextrose/mainline
http://git.sugarlabs.org/dextrose/mainline/commit/e0e3445f77a68a00409d61e8d7a0aaec65c8a5b7

Reviewed-by: Anish Mangal <anish at activitycentral.org>
Acked-by: Anish Mangal <anish at activitycentral.org>


More information about the Dextrose mailing list