carolinux / gdata-python-client

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

Booleans are handled improperly when serializing to XML #611

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

client = gdata.apps.client.AppsClient(domain=DOMAIN)
client.ClientLogin(email=ADMIN_USERNAME, password=ADMIN_PASSWORD, source='apps')
user_entry = client.RetrieveUser(args.username)        
user_entry.login.suspended = True

This is taken from 
https://developers.google.com/google-apps/provisioning/#suspending_a_user_accoun
t so I expect it to be working code :) 

What is the expected output? What do you see instead?

I expect this code to work. Instead I get: 

  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1053, in _raise_serialization_error
    "cannot serialize %r (type %s)" % (text, type(text).__name__)
TypeError: cannot serialize True (type bool)

What version of the product are you using?

2.0.17

Please provide any additional information below.

You might use:

user_entry.login.suspended  = '1' 

as a workaround

Original issue reported on code.google.com by jbz...@gmail.com on 2 May 2012 at 10:15

GoogleCodeExporter commented 9 years ago
The working workaround is:

 user_entry.login.suspended = 'true'

`user_entry.login.suspended  = '1'` code does not raise exception but the 
account is not suspended after it was executed.

Original comment by adi...@gmail.com on 5 Sep 2012 at 3:42