GTG

Merge lp:~h-pawan/gtg/rtm-sync-errors into lp:~gtg/gtg/old-trunk

Proposed by Pawan Hegde
Status: Rejected
Rejected by: Izidor Matušov
Proposed branch: lp:~h-pawan/gtg/rtm-sync-errors
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 132 lines (+19/-11)
4 files modified
CHANGELOG (+2/-0)
GTG/backends/backend_rtm.py (+11/-8)
GTG/backends/genericbackend.py (+2/-2)
GTG/gtk/browser/custominfobar.py (+4/-1)
To merge this branch: bzr merge lp:~h-pawan/gtg/rtm-sync-errors
Reviewer Review Type Date Requested Status
Nimit Shah Needs Fixing
Review via email: mp+209978@code.launchpad.net

Description of the change

Resolves backend pickles not getting read and RTM sync error that caused tasks to get deleted.

To post a comment you must log in.
Revision history for this message
Nimit Shah (nimit-svnit) wrote :

Hi Pawan,
It is still asking me to register the app everytime. Please look into it.

review: Needs Fixing
lp:~h-pawan/gtg/rtm-sync-errors updated
1363. By Pawan Hegde

Added a callback to the token saving function on authentication. Added a message to tell the user the same.

1364. By Pawan Hegde

merged changes

1365. By Pawan Hegde

changed wording of message

Revision history for this message
Pawan Hegde (h-pawan) wrote :

> Hi Pawan,
> It is still asking me to register the app everytime. Please look into it.

Now, GTG will save your authentication information the first time you add the backend. This does not wait for the periodic refresh, and happens via a callback. (It still takes a few seconds to verify the authorization with RTM, so I have added a message for this. Hopefully this prevents users from closing the app right after confirming.)
On every subsequent start of the app, this information will be reloaded from disk, even if you disable the backend.
However, if you remove the backend, then the authorization information gets deleted along with all other information about the backend. You'll have to again confirm on adding the backend to GTG.

lp:~h-pawan/gtg/rtm-sync-errors updated
1366. By Pawan Hegde

Merged with latest branch

Revision history for this message
Nimit Shah (nimit-svnit) wrote :

Hi Pawan,
I am constantly getting an error saying that my pickle file is damaged and
hence it is asking me to authenticate again and again. Also I am getting
this error:
(process:2810): GLib-CRITICAL **: g_slice_set_config: assertion
'sys_page_size == 0' failed
The above error comes only when I have rtm backend enabled.

Nimit Shah

On Fri, Mar 14, 2014 at 12:55 AM, Pawan Hegde <email address hidden> wrote:

> > Hi Pawan,
> > It is still asking me to register the app everytime. Please look into it.
>
> Now, GTG will save your authentication information the first time you add
> the backend. This does not wait for the periodic refresh, and happens via a
> callback. (It still takes a few seconds to verify the authorization with
> RTM, so I have added a message for this. Hopefully this prevents users from
> closing the app right after confirming.)
> On every subsequent start of the app, this information will be reloaded
> from disk, even if you disable the backend.
> However, if you remove the backend, then the authorization information
> gets deleted along with all other information about the backend. You'll
> have to again confirm on adding the backend to GTG.
> --
> https://code.launchpad.net/~h-pawan/gtg/rtm-sync-errors/+merge/209978
> You are reviewing the proposed merge of lp:~h-pawan/gtg/rtm-sync-errors
> into lp:gtg.
>

Revision history for this message
Izidor Matušov (izidor) wrote :

GTG moved the primary code hosting over to Github: https://github.com/getting-things-gnome

If your patch is still relevant and you would like to get it merged, create a pull request on github against branch https://github.com/getting-things-gnome/gtg

Unmerged revisions

1366. By Pawan Hegde

Merged with latest branch

1365. By Pawan Hegde

changed wording of message

1364. By Pawan Hegde

merged changes

1363. By Pawan Hegde

Added a callback to the token saving function on authentication. Added a message to tell the user the same.

1362. By Pawan Hegde

Merged two commit branches into one. Resolved conflicts in CHANGELOG

1361. By Pawan Hegde

Updated CHANGELOG

1360. By Pawan Hegde

Fixed RTM sync errors

1359. By Pawan Hegde

Added name to changelog

1358. By Pawan Hegde

Merged

1357. By Pawan Hegde

Access pickled files as binary. Allow settings and credentials to be stored locally. Removes the need to get authenticated every time.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CHANGELOG'
2--- CHANGELOG 2014-03-15 19:00:54 +0000
3+++ CHANGELOG 2014-03-16 19:30:38 +0000
4@@ -26,6 +26,8 @@
5 * Fix for Python3 compatibility and unable to close on Clicking on close button, by Fabiano Fidencio
6 * Fix for bug ##1042419 : Gtg-0.2.9.tar.gz file has 'gtg' and 'GTG', by Izidor Matušov
7 * Moving to Sphinx for documentation and improving the scripts, by Izidor Matušov
8+ * Fix for bug #1286495 : Backends ask for authentication every time, by Pawan Hegde
9+ * Fix for bug #932732 : Synchronizying twice with RTM removes all tasks, by Pawan Hegde
10
11 2013-11-24 Getting Things GNOME! 0.3.1
12 * Fix for bug #1024473: Have 'Show Main Window' in notification area, by Antonio Roquentin
13
14=== modified file 'GTG/backends/backend_rtm.py'
15--- GTG/backends/backend_rtm.py 2014-03-09 12:59:59 +0000
16+++ GTG/backends/backend_rtm.py 2014-03-16 19:30:38 +0000
17@@ -87,7 +87,6 @@
18 self.token = self._load_pickled_file(self.token_path, None)
19 self.enqueued_start_get_task = False
20 self.login_event = threading.Event()
21- self._this_is_the_first_loop = True
22
23 def initialize(self):
24 """
25@@ -95,6 +94,7 @@
26 """
27 super(Backend, self).initialize()
28 self.rtm_proxy = RTMProxy(self._ask_user_to_confirm_authentication,
29+ self._on_successful_authentication,
30 self.token)
31
32 def save_state(self):
33@@ -120,6 +120,10 @@
34 ).INTERACTION_CONFIRM,
35 "on_login")
36 self.login_event.wait()
37+ BackendSignals().interaction_requested(self.get_id(),
38+ "Thank you. Give us a moment to verify and save your authorization",
39+ BackendSignals(
40+ ).INTERACTION_TEXT, None)
41
42 def on_login(self):
43 '''
44@@ -142,9 +146,6 @@
45 current_rtm_task_ids = [tid for tid in
46 self.rtm_proxy.get_rtm_tasks_dict().keys()]
47
48- if self._this_is_the_first_loop:
49- self._on_successful_authentication()
50-
51 # If it's the very first time the backend is run, it's possible that
52 # the user already synced his tasks in some way (but we don't know
53 # that). Therefore, we attempt to induce those tasks relationships
54@@ -200,9 +201,8 @@
55
56 def _on_successful_authentication(self):
57 '''
58- Saves the token and requests a full flush on first autentication
59+ Saves the token and requests a full flush on first authentication
60 '''
61- self._this_is_the_first_loop = False
62 self._store_pickled_file(self.token_path,
63 self.rtm_proxy.get_auth_token())
64 # we ask the Datastore to flush all the tasks on us
65@@ -514,8 +514,10 @@
66
67 def __init__(self,
68 auth_confirm_fun,
69+ on_authentication_fun,
70 token=None):
71 self.auth_confirm = auth_confirm_fun
72+ self.on_auth = on_authentication_fun
73 self.token = token
74 self.authenticated = threading.Event()
75 self.login_event = threading.Event()
76@@ -576,6 +578,7 @@
77 try:
78 if self._login():
79 self.authenticated.set()
80+ self.on_auth()
81 except IOError:
82 BackendSignals().backend_failed(self.get_id(),
83 BackendSignals.ERRNO_NETWORK)
84@@ -655,8 +658,8 @@
85 http://www.rememberthemilk.com/services/api/tasks.rtm
86 '''
87 list_object_wrapper = self.rtm.tasks.getList(list_id=list_id,
88- filter='includeArchived\
89- :true').tasks
90+ filter='includeArchived'
91+ ':true').tasks
92 list_object_list = self.__getattr_the_rtm_way(
93 list_object_wrapper, 'list')
94 if not list_object_list:
95
96=== modified file 'GTG/backends/genericbackend.py'
97--- GTG/backends/genericbackend.py 2013-11-25 02:37:46 +0000
98+++ GTG/backends/genericbackend.py 2014-03-16 19:30:38 +0000
99@@ -576,7 +576,7 @@
100 if not os.path.exists(path):
101 return default_value
102
103- with open(path, 'r') as file:
104+ with open(path, 'rb') as file:
105 try:
106 return pickle.load(file)
107 except Exception:
108@@ -587,7 +587,7 @@
109 for i in range(1, PICKLE_BACKUP_NBR + 1):
110 backup_file = "%s.bak.%d" % (path, i)
111 if os.path.exists(backup_file):
112- with open(backup_file, 'r') as file:
113+ with open(backup_file, 'rb') as file:
114 try:
115 data = pickle.load(file)
116 Log.info("Succesfully restored backup #%d for '%s'" %
117
118=== modified file 'GTG/gtk/browser/custominfobar.py'
119--- GTG/gtk/browser/custominfobar.py 2013-11-25 02:37:46 +0000
120+++ GTG/gtk/browser/custominfobar.py 2014-03-16 19:30:38 +0000
121@@ -152,7 +152,10 @@
122 '''
123 if event == Gtk.ResponseType.ACCEPT:
124 if self.interaction_type == BackendSignals().INTERACTION_TEXT:
125- self._prepare_textual_interaction()
126+ if self.callback != None:
127+ self._prepare_textual_interaction()
128+ else:
129+ self.hide()
130 print("done")
131 elif self.interaction_type == BackendSignals().INTERACTION_CONFIRM:
132 self.hide()

Subscribers

People subscribed via source and target branches

to status/vote changes: