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
=== modified file 'CHANGELOG'
--- CHANGELOG 2014-03-15 19:00:54 +0000
+++ CHANGELOG 2014-03-16 19:30:38 +0000
@@ -26,6 +26,8 @@
26 * Fix for Python3 compatibility and unable to close on Clicking on close button, by Fabiano Fidencio26 * Fix for Python3 compatibility and unable to close on Clicking on close button, by Fabiano Fidencio
27 * Fix for bug ##1042419 : Gtg-0.2.9.tar.gz file has 'gtg' and 'GTG', by Izidor Matušov27 * Fix for bug ##1042419 : Gtg-0.2.9.tar.gz file has 'gtg' and 'GTG', by Izidor Matušov
28 * Moving to Sphinx for documentation and improving the scripts, by Izidor Matušov28 * Moving to Sphinx for documentation and improving the scripts, by Izidor Matušov
29 * Fix for bug #1286495 : Backends ask for authentication every time, by Pawan Hegde
30 * Fix for bug #932732 : Synchronizying twice with RTM removes all tasks, by Pawan Hegde
2931
302013-11-24 Getting Things GNOME! 0.3.1322013-11-24 Getting Things GNOME! 0.3.1
31 * Fix for bug #1024473: Have 'Show Main Window' in notification area, by Antonio Roquentin33 * Fix for bug #1024473: Have 'Show Main Window' in notification area, by Antonio Roquentin
3234
=== modified file 'GTG/backends/backend_rtm.py'
--- GTG/backends/backend_rtm.py 2014-03-09 12:59:59 +0000
+++ GTG/backends/backend_rtm.py 2014-03-16 19:30:38 +0000
@@ -87,7 +87,6 @@
87 self.token = self._load_pickled_file(self.token_path, None)87 self.token = self._load_pickled_file(self.token_path, None)
88 self.enqueued_start_get_task = False88 self.enqueued_start_get_task = False
89 self.login_event = threading.Event()89 self.login_event = threading.Event()
90 self._this_is_the_first_loop = True
9190
92 def initialize(self):91 def initialize(self):
93 """92 """
@@ -95,6 +94,7 @@
95 """94 """
96 super(Backend, self).initialize()95 super(Backend, self).initialize()
97 self.rtm_proxy = RTMProxy(self._ask_user_to_confirm_authentication,96 self.rtm_proxy = RTMProxy(self._ask_user_to_confirm_authentication,
97 self._on_successful_authentication,
98 self.token)98 self.token)
9999
100 def save_state(self):100 def save_state(self):
@@ -120,6 +120,10 @@
120 ).INTERACTION_CONFIRM,120 ).INTERACTION_CONFIRM,
121 "on_login")121 "on_login")
122 self.login_event.wait()122 self.login_event.wait()
123 BackendSignals().interaction_requested(self.get_id(),
124 "Thank you. Give us a moment to verify and save your authorization",
125 BackendSignals(
126 ).INTERACTION_TEXT, None)
123127
124 def on_login(self):128 def on_login(self):
125 '''129 '''
@@ -142,9 +146,6 @@
142 current_rtm_task_ids = [tid for tid in146 current_rtm_task_ids = [tid for tid in
143 self.rtm_proxy.get_rtm_tasks_dict().keys()]147 self.rtm_proxy.get_rtm_tasks_dict().keys()]
144148
145 if self._this_is_the_first_loop:
146 self._on_successful_authentication()
147
148 # If it's the very first time the backend is run, it's possible that149 # If it's the very first time the backend is run, it's possible that
149 # the user already synced his tasks in some way (but we don't know150 # the user already synced his tasks in some way (but we don't know
150 # that). Therefore, we attempt to induce those tasks relationships151 # that). Therefore, we attempt to induce those tasks relationships
@@ -200,9 +201,8 @@
200201
201 def _on_successful_authentication(self):202 def _on_successful_authentication(self):
202 '''203 '''
203 Saves the token and requests a full flush on first autentication204 Saves the token and requests a full flush on first authentication
204 '''205 '''
205 self._this_is_the_first_loop = False
206 self._store_pickled_file(self.token_path,206 self._store_pickled_file(self.token_path,
207 self.rtm_proxy.get_auth_token())207 self.rtm_proxy.get_auth_token())
208 # we ask the Datastore to flush all the tasks on us208 # we ask the Datastore to flush all the tasks on us
@@ -514,8 +514,10 @@
514514
515 def __init__(self,515 def __init__(self,
516 auth_confirm_fun,516 auth_confirm_fun,
517 on_authentication_fun,
517 token=None):518 token=None):
518 self.auth_confirm = auth_confirm_fun519 self.auth_confirm = auth_confirm_fun
520 self.on_auth = on_authentication_fun
519 self.token = token521 self.token = token
520 self.authenticated = threading.Event()522 self.authenticated = threading.Event()
521 self.login_event = threading.Event()523 self.login_event = threading.Event()
@@ -576,6 +578,7 @@
576 try:578 try:
577 if self._login():579 if self._login():
578 self.authenticated.set()580 self.authenticated.set()
581 self.on_auth()
579 except IOError:582 except IOError:
580 BackendSignals().backend_failed(self.get_id(),583 BackendSignals().backend_failed(self.get_id(),
581 BackendSignals.ERRNO_NETWORK)584 BackendSignals.ERRNO_NETWORK)
@@ -655,8 +658,8 @@
655 http://www.rememberthemilk.com/services/api/tasks.rtm658 http://www.rememberthemilk.com/services/api/tasks.rtm
656 '''659 '''
657 list_object_wrapper = self.rtm.tasks.getList(list_id=list_id,660 list_object_wrapper = self.rtm.tasks.getList(list_id=list_id,
658 filter='includeArchived\661 filter='includeArchived'
659 :true').tasks662 ':true').tasks
660 list_object_list = self.__getattr_the_rtm_way(663 list_object_list = self.__getattr_the_rtm_way(
661 list_object_wrapper, 'list')664 list_object_wrapper, 'list')
662 if not list_object_list:665 if not list_object_list:
663666
=== modified file 'GTG/backends/genericbackend.py'
--- GTG/backends/genericbackend.py 2013-11-25 02:37:46 +0000
+++ GTG/backends/genericbackend.py 2014-03-16 19:30:38 +0000
@@ -576,7 +576,7 @@
576 if not os.path.exists(path):576 if not os.path.exists(path):
577 return default_value577 return default_value
578578
579 with open(path, 'r') as file:579 with open(path, 'rb') as file:
580 try:580 try:
581 return pickle.load(file)581 return pickle.load(file)
582 except Exception:582 except Exception:
@@ -587,7 +587,7 @@
587 for i in range(1, PICKLE_BACKUP_NBR + 1):587 for i in range(1, PICKLE_BACKUP_NBR + 1):
588 backup_file = "%s.bak.%d" % (path, i)588 backup_file = "%s.bak.%d" % (path, i)
589 if os.path.exists(backup_file):589 if os.path.exists(backup_file):
590 with open(backup_file, 'r') as file:590 with open(backup_file, 'rb') as file:
591 try:591 try:
592 data = pickle.load(file)592 data = pickle.load(file)
593 Log.info("Succesfully restored backup #%d for '%s'" %593 Log.info("Succesfully restored backup #%d for '%s'" %
594594
=== modified file 'GTG/gtk/browser/custominfobar.py'
--- GTG/gtk/browser/custominfobar.py 2013-11-25 02:37:46 +0000
+++ GTG/gtk/browser/custominfobar.py 2014-03-16 19:30:38 +0000
@@ -152,7 +152,10 @@
152 '''152 '''
153 if event == Gtk.ResponseType.ACCEPT:153 if event == Gtk.ResponseType.ACCEPT:
154 if self.interaction_type == BackendSignals().INTERACTION_TEXT:154 if self.interaction_type == BackendSignals().INTERACTION_TEXT:
155 self._prepare_textual_interaction()155 if self.callback != None:
156 self._prepare_textual_interaction()
157 else:
158 self.hide()
156 print("done")159 print("done")
157 elif self.interaction_type == BackendSignals().INTERACTION_CONFIRM:160 elif self.interaction_type == BackendSignals().INTERACTION_CONFIRM:
158 self.hide()161 self.hide()

Subscribers

People subscribed via source and target branches

to status/vote changes: