Closed GoogleCodeExporter closed 8 years ago
[deleted comment]
This is really hard to debug without the code that makes these "executed
multiple times in same transaction"
Original comment by dhermes@google.com
on 11 Jun 2013 at 4:21
by transaction, I mean to state about single app engine request having multiple
execute() calls, and no two requests are same.
this is a sample code:
baseFileKeys =
{'presntation':<fileid>,'doc':<fileid>,'sheet':<fileId>,'drawing':<fileId>}
for key in baseFileKeys:
fileId = baseFileKeys[key]
file = service.files().copy(fileId=fileId, pinned = True, body=body).execute()
perm = service.permissions().insert(fileId= file['id'], body=new_permission).execute()
# after 3 iterations
Mime type is : sheet
URL being requested:
https://www.googleapis.com/drive/v2/files/0ArLMC-iWfQNCdDNGX01XS3REVWVkUk5Gc05QN
lIyemc/copy?pinned=true&alt=json
file has the following value~= Return:{u'kind': u'drive#permission', u'etag':
u'""', u'role': u'reader', u'type': u'anyone', u'id': u'anyone', u'selfLink':
u'https://www.googleapis.com/drive/v2/files/1TlSv13fjr8yJQCXLAvrasGQh7oq0mqhWI2t
yLCqtEy4/permissions/anyone'}
Following Query based on above result:
URL being requested:
https://www.googleapis.com/drive/v2/files/anyone/permissions?alt=json
An error occurred: <HttpError 404 when requesting
https://www.googleapis.com/drive/v2/files/anyone/permissions?alt=json returned
"File not found: anyone">
Original comment by sande...@g.advaiya.com
on 11 Jun 2013 at 4:35
It's still very unclear, sorry.
Original comment by dhermes@google.com
on 11 Jun 2013 at 10:03
Below I am stated the functions that are run in sequence, illustrated the issue
and response after each query.
#Q1
-------------------------------------------------------
file =
service.files().copy(fileId="https://www.googleapis.com/drive/v2/files/0ArLMC-iW
fQNCdDNGX01XS3REVWVkUk5Gc05QNlIyemc/copy?pinned=true&alt=json",pinned
=True, body=body).execute()
URL being requested:
https://www.googleapis.com/drive/v2/files/0ArLMC-iWfQNCdDNGX01XS3REVWVkUk5Gc05QN
lIyemc/copy?pinned=true&alt=json
#success #expected,
Response for above execution:
{u'mimeType': u'application/vnd.google-apps.document','id':'<new file ID>',
u'appDataContents': False, u'labels': {u'restricted': False, u'starred':
False,......................................
#Q2
-------------------------------------------------------
perm = service.permissions().insert(fileId= file['id'],
body=new_permission).execute()
#success #expected,
Response for above excution:
{u'kind': u'drive#permission', u'etag': u'""', u'role': u'reader', u'type':
u'anyone', u'id': u'anyone', u'selfLink':
u'https://www.googleapis.com/drive/v2/files/1TlSv13fjr8yJQCXLAvrasGQh7oq0mqhWI2t
yLCqtEy4/permissions/anyone'}
#Q3: here raised the problem, but not 100% error every-time, .
-------------------------------------------------------
file =
service.files().copy(fileId="https://www.googleapis.com/drive/v2/files/0ArLMC-iW
fQNCdDNGX01XS3REVWVkUk5Gc05QNlIyemc/copy?pinned=true&alt=json",pinned
=True, body=body).execute()
URL being requested:
https://www.googleapis.com/drive/v2/files/0ArLMC-iWfQNCdDNGX01XS3REVWVkUk5Gc05QN
lIyemc/copy?pinned=true&alt=json
#invalid Return,
Expecting a response like #Q1 but response for above execution is same of #Q2:
{u'kind': u'drive#permission', u'etag': u'""', u'role': u'reader', u'type':
u'anyone', u'id': u'anyone', u'selfLink':
u'https://www.googleapis.com/drive/v2/files/1TlSv13fjr8yJQCXLAvrasGQh7oq0mqhWI2t
yLCqtEy4/permissions/anyone'}
#Q4 Here now from above response file['id'] would be 'anyone', but we have to
pass a <doc Id> to grant permission
-------------------------------------------------------
perm = service.permissions().insert(fileId= file['id'],
body=new_permission).execute()
URL being requested:
https://www.googleapis.com/drive/v2/files/anyone/permissions?alt=json
An error follows : <HttpError 404 when requesting
https://www.googleapis.com/drive/v2/files/anyone/permissions?alt=json returned
"File not found: anyone">
rest breaks because of above error.
#Q5: copy 3 pending
#Q6: permissions to file created in Q5
#Q7: copy 4 pending
#Q8: permissions to file created in Q7
Original comment by sande...@g.advaiya.com
on 12 Jun 2013 at 10:36
Are you using mutable variables in more than one place?
Does
fileId="https://www.googleapis.com/drive/v2/files/0ArLMC-iWfQNCdDNGX01XS3REVWVkU
k5Gc05QNlIyemc/copy?pinned=true&alt=json" actually work? Shouldn't it be
fileId="0ArLMC-iWfQNCdDNGX01XS3REVWVkUk5Gc05QNlIyemc"?
Original comment by dhermes@google.com
on 12 Jun 2013 at 5:18
sorry,,, ya it should be fileId="0ArLMC-iWfQNCdDNGX01XS3REVWVkUk5Gc05QNlIyemc"..
I Just replaced the a variable in code with the url, My intension is to
illustrate we are passing file ID here.
apart from that rest is as mentioned above...
Original comment by sande...@g.advaiya.com
on 12 Jun 2013 at 6:02
Is this an outstanding issue?
Original comment by jcgregorio@google.com
on 5 Aug 2013 at 2:00
Original issue reported on code.google.com by
sande...@g.advaiya.com
on 11 Jun 2013 at 6:17