prayagverma / gdata-python-client

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

client.CreateUser(username, lastname, firstname, passwd, suspended=True) blows up #701

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. call client.ClientLogin(username, lastname, firstname, passwd, 
suspended=True)
2. watch it blow up
3. error output below 

What is the expected output? What do you see instead?
if i pass "suspended=False" it works ... so passing True shouldn't blow up ?

What version of the product are you using?
gdata-2.0.18-py2.7.egg-info

Please provide any additional information below.
client.CreateUser(user_name='test_zombie_2', family_name="lastZombie", 
given_name="bob", password='pantsprancedance', suspended=True)
                                                                                                                                  ---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-29-b4d4040ede8f> in <module>()
----> 1 client.CreateUser(user_name='test_zombie_2', family_name="lastZombie", 
given_name="bob", password='sunlightrocks', suspended=True)

/Users/timball/Documents/sunlight/GOOG-provision-user/virt/lib/python2.7/site-pa
ckages/gdata/apps/client.pyc in CreateUser(self, user_name, family_name, 
given_name, password, suspended, admin, quota_limit, password_hash_function, 
agreed_to_terms, change_password)
     91     user_entry.name = gdata.apps.data.Name(family_name=family_name,
     92                                            given_name=given_name)
---> 93     return self.Post(user_entry, uri)
     94
     95   def RetrieveUser(self, user_name):

/Users/timball/Documents/sunlight/GOOG-provision-user/virt/lib/python2.7/site-pa
ckages/gdata/client.pyc in post(self, entry, uri, auth_token, converter, 
desired_class, **kwargs)
    684     http_request = atom.http_core.HttpRequest()
    685     http_request.add_body_part(
--> 686         entry.to_string(get_xml_version(self.api_version)),
    687         'application/atom+xml')
    688     return self.request(method='POST', uri=uri, auth_token=auth_token,

/Users/timball/Documents/sunlight/GOOG-provision-user/virt/lib/python2.7/site-pa
ckages/atom/core.pyc in to_string(self, version, encoding, pretty_print)
    350     """Converts this object to XML."""
    351
--> 352     tree_string = ElementTree.tostring(self._to_tree(version, encoding))
    353
    354     if pretty_print and xmlString is not None:

/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/pyth
on2.7/xml/etree/ElementTree.pyc in tostring(element, encoding, method)
   1124     file = dummy()
   1125     file.write = data.append
-> 1126     ElementTree(element).write(file, encoding, method=method)
   1127     return "".join(data)
   1128

/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/pyth
on2.7/xml/etree/ElementTree.pyc in write(self, file_or_filename, encoding, 
xml_declaration, default_namespace, method)
    818                 )
    819             serialize = _serialize[method]
--> 820             serialize(write, self._root, encoding, qnames, namespaces)
    821         if file_or_filename is not file:
    822             file.close()

/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/pyth
on2.7/xml/etree/ElementTree.pyc in _serialize_xml(write, elem, encoding, 
qnames, namespaces)
    937                     write(_escape_cdata(text, encoding))
    938                 for e in elem:
--> 939                     _serialize_xml(write, e, encoding, qnames, None)
    940                 write("</" + tag + ">")
    941             else:

/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/pyth
on2.7/xml/etree/ElementTree.pyc in _serialize_xml(write, elem, encoding, 
qnames, namespaces)
    930                         v = qnames[v.text]
    931                     else:
--> 932                         v = _escape_attrib(v, encoding)
    933                     write(" %s=\"%s\"" % (qnames[k], v))
    934             if text or len(elem):

/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/pyth
on2.7/xml/etree/ElementTree.pyc in _escape_attrib(text, encoding)
   1090         return text.encode(encoding, "xmlcharrefreplace")
   1091     except (TypeError, AttributeError):
-> 1092         _raise_serialization_error(text)
   1093
   1094 def _escape_attrib_html(text, encoding):

/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/pyth
on2.7/xml/etree/ElementTree.pyc in _raise_serialization_error(text)
   1050 def _raise_serialization_error(text):
   1051     raise TypeError(
-> 1052         "cannot serialize %r (type %s)" % (text, type(text).__name__)
   1053         )
   1054

TypeError: cannot serialize True (type bool)

Original issue reported on code.google.com by timb...@sunlightfoundation.com on 2 Jul 2014 at 7:07