Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/rpms/sugar/sugar-Do-not-send-empty-feedback-reports-if-anonymous_with_sn-is-enabled.patch
blob: 78c62971ab08f7d632967173663a9a55c997a68f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From patchwork Sat Feb 12 02:17:17 2011
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [sugar] Do not send empty feedback reports if anonymous_with_sn is
	enabled
Date: Sat, 12 Feb 2011 07:17:17 -0000
From: Aleksey Lim <alsroot@activitycentral.org>
X-Patchwork-Id: 648
Message-Id: <1297477038-17296-1-git-send-email-alsroot@activitycentral.org>
To: dextrose@lists.sugarlabs.org

---
 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)