Closed petobens closed 9 years ago
I think that you have to restart Vim.
I restarted Vim and the behavior is same: in order to refresh the calendar I need create a new event within Vim. On the other hand the Tasks do get refreshed when I delete the ../timestamp
directory. So the problem is with the calendar events. Can you please check it and fix it? Thanks
Cannot reproduce and I cannot fix. Please read the log with opening the calendar by :Calendar -debug
. The downloaded log is saved in ~/.cache/calendar.vim/download/.
Running with :Calendar -debug
and looking into~/.cache/calendar.vim/download
I get a lot files that look like: google_calendar_download_201409092028580007
. What information is useful to you? Where should I find it? For instance, the first the files (if ordered by date modified) reads:
HTTP/1.1 404 Not Found
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Tue, 09 Sep 2014 23:29:02 GMT
Content-Type: text/html; charset=UTF-8
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alternate-Protocol: 443:quic,p=0.002
Transfer-Encoding: chunked
Not Found
And the last one of those files:
HTTP/1.1 403 Forbidden
Content-Type: application/json; charset=UTF-8
Date: Tue, 09 Sep 2014 23:29:05 GMT
Expires: Tue, 09 Sep 2014 23:29:05 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alternate-Protocol: 443:quic,p=0.002
Transfer-Encoding: chunked
{
"error": {
"errors": [
{
"domain": "calendar",
"reason": "insufficientRightsForApiAccess",
"message": "The requested data is not available."
}
],
"code": 403,
"message": "The requested data is not available."
}
}
One strange thing I notice is that it says Date: Tue, 09 Sep 2014 23:29:05 GMT
and actually the time when I execute the :Calendar -debug
command was Tue, 09 Sep 2014 20:29:05 GMT
(three hours earlier than what it shows).
Thanks for the help and patience. :)
Please remove the ~/.cache/calendar.vim/
directory and reauthorize the app to the Google Calendar.
I removed the ~/.cache/calendar.vim/
directory and reauthorized the app to the Google Calendar. The events were succesfully loaded. After doing that I created a new event in the Google calendar web app, then deleted ~/.cache/calendar.vim/timestamp/
and finally opened vim and the calendar app, and that event doesn't show up. Once again the only way to make it appear is by creating a new event from within Vim. Task synchronization works just fine. For the calendar the log reads:
HTTP/1.1 403 Forbidden
Content-Type: application/json; charset=UTF-8
Date: Thu, 11 Sep 2014 02:57:39 GMT
Expires: Thu, 11 Sep 2014 02:57:39 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alternate-Protocol: 443:quic,p=0.002
Transfer-Encoding: chunked
{
"error": {
"errors": [
{
"domain": "calendar",
"reason": "insufficientRightsForApiAccess",
"message": "The requested data is not available."
}
],
"code": 403,
"message": "The requested data is not available."
}
}
Does this problem still happen? I've looked through the log on my environment and I've never get insufficientRightsForApiAccess error. I still do not find the clue to fix this error.
I''ll do same testing and revert ASAP. Thanks
Here's a diff which generates a more detailed log. The output file is ~/calendar-vim-log.txt
. I want you to see the difference of the logs of successful case and failure case.
diff --git a/autoload/calendar/webapi.vim b/autoload/calendar/webapi.vim
index d20eaf0..07e29a7 100644
--- a/autoload/calendar/webapi.vim
+++ b/autoload/calendar/webapi.vim
@@ -181,6 +181,17 @@ function! s:request(json, async, url, ...)
call writefile(split(postdatastr, "\n"), file, "b")
endif
call s:cache.check_dir(1)
+ redir >> ~/calendar-vim-log.txt
+ silent! echo "-- s:request --"
+ silent! echo a:json
+ silent! echo a:async
+ silent! echo a:url
+ silent! echo a:000
+ if withbody
+ silent! echo postdatastr
+ endif
+ silent! echo command
+ redir END
if a:async != {}
if !calendar#setting#get('debug')
call s:cache.delete(a:async.id)
@@ -204,6 +215,12 @@ endfunction
let s:callback_datalen = {}
function! calendar#webapi#callback(id, cb)
let data = s:cache.get_raw(a:id)
+ redir >> ~/calendar-vim-log.txt
+ silent! echo "-- calendar#webapi#callback --"
+ silent! echo a:id
+ silent! echo a:cb
+ silent! echo data
+ redir END
if type(data) == type([])
let prevdatalen = get(s:callback_datalen, a:id)
let s:callback_datalen[a:id] = len(data)
Sorry for taking such a long time to reply. So I added the lines in your previous comment and got the log result of removing the ~/.cache/calendar.vim/
directory and reauthorizing the app to the Google Calendar so the events are succesfully loaded. Do you want me to copy the whole file here?
Even in the success case I get a line that reads like:
['HTTP/1.1 403 Forbidden', 'Vary: Origin', 'Vary: Referer', 'Vary: X-Origin', 'Content-Type: application/json; charset=UTF-8', 'Date: Thu, 09 Oct 2014 23:02:35 GMT', 'Expires: Thu, 09 Oct 2014 23:02:35 GMT', 'Cache-Control: private, max-age=0', 'X-Content-Type-Options: nosniff', 'X-Frame-Options: SAMEORIGIN', 'X-XSS-Protection: 1; mode=block', 'Server: GSE', 'Alternate-Protocol: 443:quic,p=0.01', 'Transfer-Encoding: chunked', '', '{', ' "error": {', ' "errors": [', ' {', ' "domain": "calendar",', ' "reason": "insufficientRightsForApiAccess",', ' "message": "The requested data is not available."', ' }', ' ],', ' "code": 403,', ' "message": "The requested data is not available."', ' }', '}']
or like this:
['HTTP/1.1 403 Forbidden', 'Vary: Origin', 'Vary: Referer', 'Vary: X-Origin', 'Content-Type: application/json; charset=UTF-8', 'Date: Thu, 09 Oct 2014 23:02:36 GMT', 'Expires: Thu, 09 Oct 2014 23:02:36 GMT', 'Cache-Control: private, max-age=0', 'X-Content-Type-Options: nosniff', 'X-Frame-Options: SAMEORIGIN', 'X-XSS-Protection: 1; mode=block', 'Server: GSE', 'Alternate-Protocol: 443:quic,p=0.01', 'Transfer-Encoding: chunked', '', '{', ' "error": {', ' "errors": [', ' {', ' "domain": "calendar",', ' "reason": "insufficientRightsForApiAccess",', ' "message": "The requested data is not available."', ' }', ' ],', ' "code": 403,', ' "message": "The requested data is not available."', ' }', '}']
Please mail the log to me itchyny.itchyny@gmail.com Edit the place which contains some private events.
This is awesome!!! Thank you so much :) Brilliant app!!!
I'm very very sorry that it took a long time to investigate the reason. But I could reproduced this problem yesterday and I could fix the issue.
I'm very sorry for not providing further assistance! But really I had no idea what was going on. Thank you once again.
YOU GUYS ROCK!!
For others coming to this thread for the same problem, the solution that ended up fixing my problem was to:
Cheers
@ntomasino thanks for a catch :100:
I read in issue #44 that:
However if I add an event to my calendar via the web interface, then remove
~/.cache/calendar.vim/timestamp/
and finally open the app, that event doesn't show up. The only way I found to make the new event show up is to create a second new event but this time from within Vim. By creating an event from within Vim, the vim calendar becomes synchronized with the web calendar.