carolinux / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
0 stars 1 forks source link

gdata.docs.client is unable to modify Acls, force= kwargs to blame? #559

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Greetings,

I am having trouble getting a DocsClient to update Acl entries, the traceback 
is:

  File "/usr/lib/python2.6/site-packages/gdata/docs/client.py", line 672, in batch_process_acl_entries
    feed, uri=resource.GetAclLink().href + '/acl', force=True, **kwargs)
  File "/usr/lib/python2.6/site-packages/gdata/client.py", line 690, in post
    desired_class=desired_class, **kwargs)
  File "/usr/lib/python2.6/site-packages/gdata/docs/client.py", line 67, in request
    return super(DocsClient, self).request(method=method, uri=uri, **kwargs)
  File "/usr/lib/python2.6/site-packages/gdata/client.py", line 267, in request
    uri=uri, auth_token=auth_token, http_request=http_request, **kwargs)
  File "/usr/lib/python2.6/site-packages/atom/client.py", line 99, in request
    value.modify_request(http_request)
AttributeError: 'bool' object has no attribute 'modify_request'

I debugged and found the 'value' to be True and the 'name' to be 'force' in 
this case, so force=True is coming from **kwargs, my code looks like the sample 
entry:

  client = CreateClient()
  doc = gdata.docs.data.Resource(type='document', title='My Sample Doc')
  doc = client.CreateResource(doc)
  acl_entry = gdata.docs.data.AclEntry(
      scope=gdata.acl.data.AclScope(value='user@example.com', type='user'),
      role=gdata.acl.data.AclRole(value='reader'),
  )
  client.AddAclEntry(doc, acl_entry, send_notification=False)

thanks!

Original issue reported on code.google.com by akrh...@gmail.com on 3 Nov 2011 at 3:17

GoogleCodeExporter commented 9 years ago
Thanks for looking into this during office hours.  I'd be happy to know of a 
workaround, since I am trying to automate permissions between google sites and 
google docs, since I can't do it via google groups (suck :) )

Original comment by akrh...@gmail.com on 18 Nov 2011 at 10:47

GoogleCodeExporter commented 9 years ago
I'm seeing the same problem. It even occurs if you run AddAclBatchSample in 
docs_v3_example.py:

Traceback (most recent call last):
  File "./docs_v3_example.py", line 243, in <module>
    samplerunner.Run(__file__)
  File "/home/fkunz/DB/de/gdata-2.0.15/samples/docs/samplerunner.py", line 42, in Run
    sample()
  File "<string>", line 229, in AddAclBatchSample
  File "/Library/Python/2.7/site-packages/gdata/docs/client.py", line 693, in batch_process_acl_entries
    feed, uri=resource.GetAclLink().href + '/acl', force=True, **kwargs)
  File "/Library/Python/2.7/site-packages/gdata/client.py", line 690, in post
    desired_class=desired_class, **kwargs)
  File "/Library/Python/2.7/site-packages/gdata/docs/client.py", line 67, in request
    return super(DocsClient, self).request(method=method, uri=uri, **kwargs)
  File "/Library/Python/2.7/site-packages/gdata/client.py", line 267, in request
    uri=uri, auth_token=auth_token, http_request=http_request, **kwargs)
  File "/Library/Python/2.7/site-packages/atom/client.py", line 98, in request
    value.modify_request(http_request)
AttributeError: 'bool' object has no attribute 'modify_request'

Original comment by m...@fredo.org on 23 Nov 2011 at 11:15

GoogleCodeExporter commented 9 years ago
I think I got it:

client.AddAclEntry(doc, acl_entry) works for me!

Original comment by sina.rab...@gmail.com on 9 Dec 2011 at 8:11

GoogleCodeExporter commented 9 years ago
force=True issue fixed in revision a27fcaf626dd.

Original comment by vicfry...@google.com on 9 Dec 2011 at 5:46